typeorm 0.2.42-dev.26581d0 → 0.2.42-dev.26815c6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +38 -0
  2. package/browser/common/RelationType.d.ts +14 -0
  3. package/browser/common/RelationType.js +3 -0
  4. package/browser/common/RelationType.js.map +1 -0
  5. package/browser/connection/Connection.d.ts +1 -1
  6. package/browser/connection/Connection.js +45 -30
  7. package/browser/connection/Connection.js.map +1 -1
  8. package/browser/connection/ConnectionMetadataBuilder.d.ts +3 -3
  9. package/browser/connection/ConnectionMetadataBuilder.js +54 -22
  10. package/browser/connection/ConnectionMetadataBuilder.js.map +1 -1
  11. package/browser/connection/ConnectionOptionsReader.js +33 -28
  12. package/browser/connection/ConnectionOptionsReader.js.map +1 -1
  13. package/browser/find-options/operator/Like.d.ts +1 -1
  14. package/browser/find-options/operator/Like.js +1 -1
  15. package/browser/find-options/operator/Like.js.map +1 -1
  16. package/browser/globals.js +34 -7
  17. package/browser/globals.js.map +1 -1
  18. package/browser/index.d.ts +1 -0
  19. package/browser/index.js +1 -0
  20. package/browser/index.js.map +1 -1
  21. package/browser/query-builder/DeleteQueryBuilder.d.ts +3 -1
  22. package/browser/query-builder/DeleteQueryBuilder.js +3 -1
  23. package/browser/query-builder/DeleteQueryBuilder.js.map +1 -1
  24. package/browser/query-builder/UpdateQueryBuilder.d.ts +3 -1
  25. package/browser/query-builder/UpdateQueryBuilder.js +3 -1
  26. package/browser/query-builder/UpdateQueryBuilder.js.map +1 -1
  27. package/browser/query-builder/WhereExpressionBuilder.d.ts +3 -1
  28. package/browser/query-builder/WhereExpressionBuilder.js.map +1 -1
  29. package/browser/util/DirectoryExportedClassesLoader.d.ts +1 -1
  30. package/browser/util/DirectoryExportedClassesLoader.js +55 -31
  31. package/browser/util/DirectoryExportedClassesLoader.js.map +1 -1
  32. package/browser/util/ImportUtils.d.ts +1 -0
  33. package/browser/util/ImportUtils.js +90 -0
  34. package/browser/util/ImportUtils.js.map +1 -0
  35. package/commands/InitCommand.d.ts +9 -7
  36. package/commands/InitCommand.js +72 -43
  37. package/commands/InitCommand.js.map +1 -1
  38. package/common/RelationType.d.ts +14 -0
  39. package/common/RelationType.js +4 -0
  40. package/common/RelationType.js.map +1 -0
  41. package/connection/Connection.d.ts +1 -1
  42. package/connection/Connection.js +45 -30
  43. package/connection/Connection.js.map +1 -1
  44. package/connection/ConnectionMetadataBuilder.d.ts +3 -3
  45. package/connection/ConnectionMetadataBuilder.js +53 -21
  46. package/connection/ConnectionMetadataBuilder.js.map +1 -1
  47. package/connection/ConnectionOptionsReader.js +32 -27
  48. package/connection/ConnectionOptionsReader.js.map +1 -1
  49. package/find-options/operator/Like.d.ts +1 -1
  50. package/find-options/operator/Like.js +1 -1
  51. package/find-options/operator/Like.js.map +1 -1
  52. package/globals.js +33 -6
  53. package/globals.js.map +1 -1
  54. package/index.d.ts +1 -0
  55. package/index.js +1 -0
  56. package/index.js.map +1 -1
  57. package/index.mjs +352 -0
  58. package/package.json +1 -1
  59. package/query-builder/DeleteQueryBuilder.d.ts +3 -1
  60. package/query-builder/DeleteQueryBuilder.js +3 -1
  61. package/query-builder/DeleteQueryBuilder.js.map +1 -1
  62. package/query-builder/UpdateQueryBuilder.d.ts +3 -1
  63. package/query-builder/UpdateQueryBuilder.js +3 -1
  64. package/query-builder/UpdateQueryBuilder.js.map +1 -1
  65. package/query-builder/WhereExpressionBuilder.d.ts +3 -1
  66. package/query-builder/WhereExpressionBuilder.js.map +1 -1
  67. package/util/DirectoryExportedClassesLoader.d.ts +1 -1
  68. package/util/DirectoryExportedClassesLoader.js +54 -31
  69. package/util/DirectoryExportedClassesLoader.js.map +1 -1
  70. package/util/ImportUtils.d.ts +1 -0
  71. package/util/ImportUtils.js +94 -0
  72. package/util/ImportUtils.js.map +1 -0
@@ -1,4 +1,4 @@
1
- import { __awaiter, __generator } from "tslib";
1
+ import { __awaiter, __generator, __read } from "tslib";
2
2
  import appRootPath from "app-root-path";
3
3
  import path from "path";
4
4
  import { PlatformTools } from "../platform/PlatformTools";
@@ -6,6 +6,7 @@ import { ConnectionOptionsEnvReader } from "./options-reader/ConnectionOptionsEn
6
6
  import { ConnectionOptionsYmlReader } from "./options-reader/ConnectionOptionsYmlReader";
7
7
  import { ConnectionOptionsXmlReader } from "./options-reader/ConnectionOptionsXmlReader";
8
8
  import { TypeORMError } from "../error";
9
+ import { importOrRequireFile } from "../util/ImportUtils";
9
10
  /**
10
11
  * Reads connection options from the ormconfig.
11
12
  * Can read from multiple file extensions including env, json, js, xml and yml.
@@ -87,13 +88,13 @@ var ConnectionOptionsReader = /** @class */ (function () {
87
88
  */
88
89
  ConnectionOptionsReader.prototype.load = function () {
89
90
  return __awaiter(this, void 0, void 0, function () {
90
- var connectionOptions, fileFormats, possibleExtension, fileExtension, foundFileFormat, configFile, configModule;
91
+ var connectionOptions, fileFormats, possibleExtension, fileExtension, foundFileFormat, configFile, _a, importOrRequireResult, moduleSystem, configModule;
91
92
  var _this = this;
92
- return __generator(this, function (_a) {
93
- switch (_a.label) {
93
+ return __generator(this, function (_b) {
94
+ switch (_b.label) {
94
95
  case 0:
95
96
  connectionOptions = undefined;
96
- fileFormats = ["env", "js", "cjs", "ts", "json", "yml", "yaml", "xml"];
97
+ fileFormats = ["env", "js", "mjs", "cjs", "ts", "mts", "cts", "json", "yml", "yaml", "xml"];
97
98
  possibleExtension = this.baseFilePath.substr(this.baseFilePath.lastIndexOf("."));
98
99
  fileExtension = fileFormats.find(function (extension) { return "." + extension === possibleExtension; });
99
100
  foundFileFormat = fileExtension || fileFormats.find(function (format) {
@@ -110,43 +111,47 @@ var ConnectionOptionsReader = /** @class */ (function () {
110
111
  if (!(PlatformTools.getEnvVariable("TYPEORM_CONNECTION") || PlatformTools.getEnvVariable("TYPEORM_URL"))) return [3 /*break*/, 2];
111
112
  return [4 /*yield*/, new ConnectionOptionsEnvReader().read()];
112
113
  case 1:
113
- connectionOptions = _a.sent();
114
- return [3 /*break*/, 11];
114
+ connectionOptions = _b.sent();
115
+ return [3 /*break*/, 12];
115
116
  case 2:
116
- if (!(foundFileFormat === "js" || foundFileFormat === "cjs" || foundFileFormat === "ts")) return [3 /*break*/, 4];
117
- return [4 /*yield*/, require(configFile)];
117
+ if (!(foundFileFormat === "js" || foundFileFormat === "mjs" || foundFileFormat === "cjs" ||
118
+ foundFileFormat === "ts" || foundFileFormat === "mts" || foundFileFormat === "cts")) return [3 /*break*/, 5];
119
+ return [4 /*yield*/, importOrRequireFile(configFile)];
118
120
  case 3:
119
- configModule = _a.sent();
120
- if (configModule && "__esModule" in configModule && "default" in configModule) {
121
+ _a = __read.apply(void 0, [_b.sent(), 2]), importOrRequireResult = _a[0], moduleSystem = _a[1];
122
+ return [4 /*yield*/, importOrRequireResult];
123
+ case 4:
124
+ configModule = _b.sent();
125
+ if (moduleSystem === "esm" || (configModule && "__esModule" in configModule && "default" in configModule)) {
121
126
  connectionOptions = configModule.default;
122
127
  }
123
128
  else {
124
129
  connectionOptions = configModule;
125
130
  }
126
- return [3 /*break*/, 11];
127
- case 4:
128
- if (!(foundFileFormat === "json")) return [3 /*break*/, 5];
129
- connectionOptions = require(configFile);
130
- return [3 /*break*/, 11];
131
+ return [3 /*break*/, 12];
131
132
  case 5:
132
- if (!(foundFileFormat === "yml")) return [3 /*break*/, 7];
133
- return [4 /*yield*/, new ConnectionOptionsYmlReader().read(configFile)];
133
+ if (!(foundFileFormat === "json")) return [3 /*break*/, 6];
134
+ connectionOptions = require(configFile);
135
+ return [3 /*break*/, 12];
134
136
  case 6:
135
- connectionOptions = _a.sent();
136
- return [3 /*break*/, 11];
137
- case 7:
138
- if (!(foundFileFormat === "yaml")) return [3 /*break*/, 9];
137
+ if (!(foundFileFormat === "yml")) return [3 /*break*/, 8];
139
138
  return [4 /*yield*/, new ConnectionOptionsYmlReader().read(configFile)];
139
+ case 7:
140
+ connectionOptions = _b.sent();
141
+ return [3 /*break*/, 12];
140
142
  case 8:
141
- connectionOptions = _a.sent();
142
- return [3 /*break*/, 11];
143
+ if (!(foundFileFormat === "yaml")) return [3 /*break*/, 10];
144
+ return [4 /*yield*/, new ConnectionOptionsYmlReader().read(configFile)];
143
145
  case 9:
144
- if (!(foundFileFormat === "xml")) return [3 /*break*/, 11];
145
- return [4 /*yield*/, new ConnectionOptionsXmlReader().read(configFile)];
146
+ connectionOptions = _b.sent();
147
+ return [3 /*break*/, 12];
146
148
  case 10:
147
- connectionOptions = _a.sent();
148
- _a.label = 11;
149
+ if (!(foundFileFormat === "xml")) return [3 /*break*/, 12];
150
+ return [4 /*yield*/, new ConnectionOptionsXmlReader().read(configFile)];
149
151
  case 11:
152
+ connectionOptions = _b.sent();
153
+ _b.label = 12;
154
+ case 12:
150
155
  // normalize and return connection options
151
156
  if (connectionOptions) {
152
157
  return [2 /*return*/, this.normalizeConnectionOptions(connectionOptions)];
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAC,0BAA0B,EAAC,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAC,0BAA0B,EAAC,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAC,0BAA0B,EAAC,MAAM,6CAA6C,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;GAGG;AACH;IAEI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,iCAAsB,OAWrB;QAXqB,YAAO,GAAP,OAAO,CAW5B;IACD,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACG,qCAAG,GAAT;;;;;4BACoB,qBAAM,IAAI,CAAC,IAAI,EAAE,EAAA;;wBAA3B,OAAO,GAA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,CAAC,IAAI,KAAK,gBAAgB,EAAE;gBAChE,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ;oBACpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,GAAG,IAAK,gBAAgB;oBAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,IAAI,mBAAmB;oBAC9D,OAAO,CAAC,QAAQ,KAAK,UAAU,EAAE;oBACjC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE;wBACnB,QAAQ,EAAE,KAAI,CAAC,aAAa,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ;qBACxD,CAAC,CAAC;iBACN;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAKD,sBAAc,iDAAY;QAH1B;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;;;OAAA;IAKD,sBAAc,kDAAa;QAH3B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;gBACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAE7B,OAAO,WAAW,CAAC,IAAI,CAAC;QAC5B,CAAC;;;OAAA;IAKD,sBAAc,mDAAc;QAH5B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YAEnC,OAAO,WAAW,CAAC;QACvB,CAAC;;;OAAA;IAEL,8BAAC;AAAD,CA9MA,AA8MC,IAAA","file":"ConnectionOptionsReader.js","sourcesContent":["import appRootPath from \"app-root-path\";\nimport path from \"path\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {PlatformTools} from \"../platform/PlatformTools\";\nimport {ConnectionOptionsEnvReader} from \"./options-reader/ConnectionOptionsEnvReader\";\nimport {ConnectionOptionsYmlReader} from \"./options-reader/ConnectionOptionsYmlReader\";\nimport {ConnectionOptionsXmlReader} from \"./options-reader/ConnectionOptionsXmlReader\";\nimport { TypeORMError } from \"../error\";\n\n/**\n * Reads connection options from the ormconfig.\n * Can read from multiple file extensions including env, json, js, xml and yml.\n */\nexport class ConnectionOptionsReader {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected options?: {\n /**\n * Directory where ormconfig should be read from.\n * By default its your application root (where your app package.json is located).\n */\n root?: string,\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n }) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async all(): Promise<ConnectionOptions[]> {\n const options = await this.load();\n if (!options)\n throw new TypeORMError(`No connection options were found in any orm configuration files.`);\n\n return options;\n }\n\n /**\n * Gets a connection with a given name read from ormconfig.\n * If connection with such name would not be found then it throw error.\n */\n async get(name: string): Promise<ConnectionOptions> {\n const allOptions = await this.all();\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n if (!targetOptions)\n throw new TypeORMError(`Cannot find connection ${name} because its not defined in any orm configuration files.`);\n\n return targetOptions;\n }\n\n /**\n * Checks if there is a TypeORM configuration file.\n */\n async has(name: string): Promise<boolean> {\n const allOptions = await this.load();\n if (!allOptions)\n return false;\n\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n return !!targetOptions;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<ConnectionOptions[]|undefined> {\n let connectionOptions: ConnectionOptions|ConnectionOptions[]|undefined = undefined;\n\n const fileFormats = [\"env\", \"js\", \"cjs\", \"ts\", \"json\", \"yml\", \"yaml\", \"xml\"];\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = this.baseFilePath.substr(this.baseFilePath.lastIndexOf(\".\"));\n const fileExtension = fileFormats.find(extension => `.${extension}` === possibleExtension);\n\n // try to find any of following configuration formats\n const foundFileFormat = fileExtension || fileFormats.find(format => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format);\n });\n\n // Determine config file name\n const configFile = fileExtension ? this.baseFilePath : this.baseFilePath + \".\" + foundFileFormat;\n\n // if .env file found then load all its variables into process.env using dotenv package\n if (foundFileFormat === \"env\") {\n PlatformTools.dotenv(configFile);\n } else if (PlatformTools.fileExist(this.baseDirectory + \"/.env\")) {\n PlatformTools.dotenv(this.baseDirectory + \"/.env\");\n }\n\n // try to find connection options from any of available sources of configuration\n if (PlatformTools.getEnvVariable(\"TYPEORM_CONNECTION\") || PlatformTools.getEnvVariable(\"TYPEORM_URL\")) {\n connectionOptions = await new ConnectionOptionsEnvReader().read();\n\n } else if (foundFileFormat === \"js\" || foundFileFormat === \"cjs\" || foundFileFormat === \"ts\") {\n const configModule = await require(configFile);\n\n if (configModule && \"__esModule\" in configModule && \"default\" in configModule) {\n connectionOptions = configModule.default;\n } else {\n connectionOptions = configModule;\n }\n\n } else if (foundFileFormat === \"json\") {\n connectionOptions = require(configFile);\n\n } else if (foundFileFormat === \"yml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"yaml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"xml\") {\n connectionOptions = await new ConnectionOptionsXmlReader().read(configFile);\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions);\n }\n\n return undefined;\n }\n\n /**\n * Normalize connection options.\n */\n protected normalizeConnectionOptions(connectionOptions: ConnectionOptions|ConnectionOptions[]): ConnectionOptions[] {\n if (!(Array.isArray(connectionOptions)))\n connectionOptions = [connectionOptions];\n\n connectionOptions.forEach(options => {\n if (options.entities) {\n const entities = (options.entities as any[]).map(entity => {\n if (typeof entity === \"string\" && entity.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + entity;\n\n return entity;\n });\n Object.assign(connectionOptions, { entities: entities });\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(subscriber => {\n if (typeof subscriber === \"string\" && subscriber.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + subscriber;\n\n return subscriber;\n });\n Object.assign(connectionOptions, { subscribers: subscribers });\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(migration => {\n if (typeof migration === \"string\" && migration.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + migration;\n\n return migration;\n });\n Object.assign(connectionOptions, { migrations: migrations });\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"sqlite\" || options.type === \"better-sqlite3\") {\n if (typeof options.database === \"string\" &&\n options.database.substr(0, 1) !== \"/\" && // unix absolute\n options.database.substr(1, 2) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\") {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database\n });\n }\n }\n });\n\n return connectionOptions;\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return path.resolve(this.baseDirectory, this.baseConfigName);\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n if (this.options && this.options.root)\n return this.options.root;\n\n return appRootPath.path;\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n if (this.options && this.options.configName)\n return this.options.configName;\n\n return \"ormconfig\";\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/connection/ConnectionOptionsReader.ts"],"names":[],"mappings":";AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,IAAI,MAAM,MAA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,CAAC,aAAa,GAAG,GAAG,GAAG,OAAO,CAAC,QAAQ;qBACxD,CAAC,CAAC;iBACN;aACJ;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAKD,sBAAc,iDAAY;QAH1B;;WAEG;aACH;YACI,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;;;OAAA;IAKD,sBAAc,kDAAa;QAH3B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI;gBACjC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAE7B,OAAO,WAAW,CAAC,IAAI,CAAC;QAC5B,CAAC;;;OAAA;IAKD,sBAAc,mDAAc;QAH5B;;WAEG;aACH;YACI,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU;gBACvC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC;YAEnC,OAAO,WAAW,CAAC;QACvB,CAAC;;;OAAA;IAEL,8BAAC;AAAD,CAlNA,AAkNC,IAAA","file":"ConnectionOptionsReader.js","sourcesContent":["import appRootPath from \"app-root-path\";\nimport path from \"path\";\nimport {ConnectionOptions} from \"./ConnectionOptions\";\nimport {PlatformTools} from \"../platform/PlatformTools\";\nimport {ConnectionOptionsEnvReader} from \"./options-reader/ConnectionOptionsEnvReader\";\nimport {ConnectionOptionsYmlReader} from \"./options-reader/ConnectionOptionsYmlReader\";\nimport {ConnectionOptionsXmlReader} from \"./options-reader/ConnectionOptionsXmlReader\";\nimport { TypeORMError } from \"../error\";\nimport {importOrRequireFile} from \"../util/ImportUtils\";\n\n/**\n * Reads connection options from the ormconfig.\n * Can read from multiple file extensions including env, json, js, xml and yml.\n */\nexport class ConnectionOptionsReader {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(protected options?: {\n /**\n * Directory where ormconfig should be read from.\n * By default its your application root (where your app package.json is located).\n */\n root?: string,\n\n /**\n * Filename of the ormconfig configuration. By default its equal to \"ormconfig\".\n */\n configName?: string\n }) {\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns all connection options read from the ormconfig.\n */\n async all(): Promise<ConnectionOptions[]> {\n const options = await this.load();\n if (!options)\n throw new TypeORMError(`No connection options were found in any orm configuration files.`);\n\n return options;\n }\n\n /**\n * Gets a connection with a given name read from ormconfig.\n * If connection with such name would not be found then it throw error.\n */\n async get(name: string): Promise<ConnectionOptions> {\n const allOptions = await this.all();\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n if (!targetOptions)\n throw new TypeORMError(`Cannot find connection ${name} because its not defined in any orm configuration files.`);\n\n return targetOptions;\n }\n\n /**\n * Checks if there is a TypeORM configuration file.\n */\n async has(name: string): Promise<boolean> {\n const allOptions = await this.load();\n if (!allOptions)\n return false;\n\n const targetOptions = allOptions.find(options => options.name === name || (name === \"default\" && !options.name));\n return !!targetOptions;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Loads all connection options from a configuration file.\n *\n * todo: get in count NODE_ENV somehow\n */\n protected async load(): Promise<ConnectionOptions[]|undefined> {\n let connectionOptions: ConnectionOptions|ConnectionOptions[]|undefined = undefined;\n\n const fileFormats = [\"env\", \"js\", \"mjs\", \"cjs\", \"ts\", \"mts\", \"cts\", \"json\", \"yml\", \"yaml\", \"xml\"];\n\n // Detect if baseFilePath contains file extension\n const possibleExtension = this.baseFilePath.substr(this.baseFilePath.lastIndexOf(\".\"));\n const fileExtension = fileFormats.find(extension => `.${extension}` === possibleExtension);\n\n // try to find any of following configuration formats\n const foundFileFormat = fileExtension || fileFormats.find(format => {\n return PlatformTools.fileExist(this.baseFilePath + \".\" + format);\n });\n\n // Determine config file name\n const configFile = fileExtension ? this.baseFilePath : this.baseFilePath + \".\" + foundFileFormat;\n\n // if .env file found then load all its variables into process.env using dotenv package\n if (foundFileFormat === \"env\") {\n PlatformTools.dotenv(configFile);\n } else if (PlatformTools.fileExist(this.baseDirectory + \"/.env\")) {\n PlatformTools.dotenv(this.baseDirectory + \"/.env\");\n }\n\n // try to find connection options from any of available sources of configuration\n if (PlatformTools.getEnvVariable(\"TYPEORM_CONNECTION\") || PlatformTools.getEnvVariable(\"TYPEORM_URL\")) {\n connectionOptions = await new ConnectionOptionsEnvReader().read();\n\n } else if (\n foundFileFormat === \"js\" || foundFileFormat === \"mjs\" || foundFileFormat === \"cjs\" ||\n foundFileFormat === \"ts\" || foundFileFormat === \"mts\" || foundFileFormat === \"cts\"\n ) {\n const [importOrRequireResult, moduleSystem] = await importOrRequireFile(configFile);\n const configModule = await importOrRequireResult;\n\n if (moduleSystem === \"esm\" || (configModule && \"__esModule\" in configModule && \"default\" in configModule)) {\n connectionOptions = configModule.default;\n } else {\n connectionOptions = configModule;\n }\n\n } else if (foundFileFormat === \"json\") {\n connectionOptions = require(configFile);\n\n } else if (foundFileFormat === \"yml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"yaml\") {\n connectionOptions = await new ConnectionOptionsYmlReader().read(configFile);\n\n } else if (foundFileFormat === \"xml\") {\n connectionOptions = await new ConnectionOptionsXmlReader().read(configFile);\n }\n\n // normalize and return connection options\n if (connectionOptions) {\n return this.normalizeConnectionOptions(connectionOptions);\n }\n\n return undefined;\n }\n\n /**\n * Normalize connection options.\n */\n protected normalizeConnectionOptions(connectionOptions: ConnectionOptions|ConnectionOptions[]): ConnectionOptions[] {\n if (!(Array.isArray(connectionOptions)))\n connectionOptions = [connectionOptions];\n\n connectionOptions.forEach(options => {\n if (options.entities) {\n const entities = (options.entities as any[]).map(entity => {\n if (typeof entity === \"string\" && entity.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + entity;\n\n return entity;\n });\n Object.assign(connectionOptions, { entities: entities });\n }\n if (options.subscribers) {\n const subscribers = (options.subscribers as any[]).map(subscriber => {\n if (typeof subscriber === \"string\" && subscriber.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + subscriber;\n\n return subscriber;\n });\n Object.assign(connectionOptions, { subscribers: subscribers });\n }\n if (options.migrations) {\n const migrations = (options.migrations as any[]).map(migration => {\n if (typeof migration === \"string\" && migration.substr(0, 1) !== \"/\")\n return this.baseDirectory + \"/\" + migration;\n\n return migration;\n });\n Object.assign(connectionOptions, { migrations: migrations });\n }\n\n // make database path file in sqlite relative to package.json\n if (options.type === \"sqlite\" || options.type === \"better-sqlite3\") {\n if (typeof options.database === \"string\" &&\n options.database.substr(0, 1) !== \"/\" && // unix absolute\n options.database.substr(1, 2) !== \":\\\\\" && // windows absolute\n options.database !== \":memory:\") {\n Object.assign(options, {\n database: this.baseDirectory + \"/\" + options.database\n });\n }\n }\n });\n\n return connectionOptions;\n }\n\n /**\n * Gets directory where configuration file should be located and configuration file name.\n */\n protected get baseFilePath(): string {\n return path.resolve(this.baseDirectory, this.baseConfigName);\n }\n\n /**\n * Gets directory where configuration file should be located.\n */\n protected get baseDirectory(): string {\n if (this.options && this.options.root)\n return this.options.root;\n\n return appRootPath.path;\n }\n\n /**\n * Gets configuration file name.\n */\n protected get baseConfigName(): string {\n if (this.options && this.options.configName)\n return this.options.configName;\n\n return \"ormconfig\";\n }\n\n}\n"],"sourceRoot":".."}
@@ -1,6 +1,6 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Example: { someField: Like("%some sting%") }
4
+ * Example: { someField: Like("%some string%") }
5
5
  */
6
6
  export declare function Like<T>(value: T | FindOperator<T>): FindOperator<T>;
@@ -1,7 +1,7 @@
1
1
  import { FindOperator } from "../FindOperator";
2
2
  /**
3
3
  * Find Options Operator.
4
- * Example: { someField: Like("%some sting%") }
4
+ * Example: { someField: Like("%some string%") }
5
5
  */
6
6
  export function Like(value) {
7
7
  return new FindOperator("like", value);
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/find-options/operator/Like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAI,KAAwB;IAC5C,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"Like.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Example: { someField: Like(\"%some sting%\") }\n */\nexport function Like<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"like\", value);\n}"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/find-options/operator/Like.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAI,KAAwB;IAC5C,OAAO,IAAI,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"Like.js","sourcesContent":["import {FindOperator} from \"../FindOperator\";\n\n/**\n * Find Options Operator.\n * Example: { someField: Like(\"%some string%\") }\n */\nexport function Like<T>(value: T|FindOperator<T>) {\n return new FindOperator(\"like\", value);\n}\n"],"sourceRoot":"../.."}
@@ -1,4 +1,4 @@
1
- import { __awaiter, __generator } from "tslib";
1
+ import { __awaiter, __generator, __values } from "tslib";
2
2
  import { MetadataArgsStorage } from "./metadata-args/MetadataArgsStorage";
3
3
  import { PlatformTools } from "./platform/PlatformTools";
4
4
  import { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader";
@@ -75,18 +75,45 @@ export function createConnection(optionsOrName) {
75
75
  */
76
76
  export function createConnections(options) {
77
77
  return __awaiter(this, void 0, void 0, function () {
78
- var connections;
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
78
+ var connections, connections_1, connections_1_1, connection, e_1_1;
79
+ var e_1, _a;
80
+ return __generator(this, function (_b) {
81
+ switch (_b.label) {
81
82
  case 0:
82
83
  if (!!options) return [3 /*break*/, 2];
83
84
  return [4 /*yield*/, new ConnectionOptionsReader().all()];
84
85
  case 1:
85
- options = _a.sent();
86
- _a.label = 2;
86
+ options = _b.sent();
87
+ _b.label = 2;
87
88
  case 2:
88
89
  connections = options.map(function (options) { return getConnectionManager().create(options); });
89
- return [2 /*return*/, Promise.all(connections.map(function (connection) { return connection.connect(); }))];
90
+ _b.label = 3;
91
+ case 3:
92
+ _b.trys.push([3, 8, 9, 10]);
93
+ connections_1 = __values(connections), connections_1_1 = connections_1.next();
94
+ _b.label = 4;
95
+ case 4:
96
+ if (!!connections_1_1.done) return [3 /*break*/, 7];
97
+ connection = connections_1_1.value;
98
+ return [4 /*yield*/, connection.connect()];
99
+ case 5:
100
+ _b.sent();
101
+ _b.label = 6;
102
+ case 6:
103
+ connections_1_1 = connections_1.next();
104
+ return [3 /*break*/, 4];
105
+ case 7: return [3 /*break*/, 10];
106
+ case 8:
107
+ e_1_1 = _b.sent();
108
+ e_1 = { error: e_1_1 };
109
+ return [3 /*break*/, 10];
110
+ case 9:
111
+ try {
112
+ if (connections_1_1 && !connections_1_1.done && (_a = connections_1.return)) _a.call(connections_1);
113
+ }
114
+ finally { if (e_1) throw e_1.error; }
115
+ return [7 /*endfinally*/];
116
+ case 10: return [2 /*return*/, connections];
90
117
  }
91
118
  });
92
119
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/globals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C;;GAEG;A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AA,0BAAkC;IAC3G,OAAO,oBAAoB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,iBAAiB,CAAS,WAAW,CAAC,CAAC;AAC7F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAI,gBAA+B,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IACtG,OAAO,oBAAoB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAC5F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAS,WAAiC,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IAC5G,OAAO,oBAAoB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAS,WAAW,CAAC,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAS,WAAkC,EAAE,KAAc,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IAC7H,IAAI,WAAW,EAAE;QACb,OAAO,aAAa,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;KAC/E;IAED,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAC9D,CAAC","file":"globals.js","sourcesContent":["import { MetadataArgsStorage } from \"./metadata-args/MetadataArgsStorage\";\nimport { PlatformTools } from \"./platform/PlatformTools\";\nimport { ConnectionOptions } from \"./connection/ConnectionOptions\";\nimport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\";\nimport { ConnectionManager } from \"./connection/ConnectionManager\";\nimport { getFromContainer } from \"./container\";\nimport { Connection } from \"./connection/Connection\";\nimport { EntityManager } from \"./entity-manager/EntityManager\";\nimport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\";\nimport { SqljsEntityManager } from \"./entity-manager/SqljsEntityManager\";\nimport { EntityTarget } from \"./common/EntityTarget\";\nimport { Repository } from \"./repository/Repository\";\nimport { TreeRepository } from \"./repository/TreeRepository\";\nimport { ObjectType } from \"./common/ObjectType\";\nimport { MongoRepository } from \"./repository/MongoRepository\";\nimport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\";\n\n/**\n * Gets metadata args storage.\n */\nexport function getMetadataArgsStorage(): MetadataArgsStorage {\n // we should store metadata storage in a global variable otherwise it brings too much problems\n // one of the problem is that if any entity (or any other) will be imported before consumer will call\n // useContainer method with his own container implementation, that entity will be registered in the\n // old old container (default one post probably) and consumer will his entity.\n // calling useContainer before he imports any entity (or any other) is not always convenient.\n // another reason is that when we run migrations typeorm is being called from a global package\n // and it may load entities which register decorators in typeorm of local package\n // this leads to impossibility of usage of entities in migrations and cli related operations\n const globalScope = PlatformTools.getGlobalVariable();\n if (!globalScope.typeormMetadataArgsStorage)\n globalScope.typeormMetadataArgsStorage = new MetadataArgsStorage();\n\n return globalScope.typeormMetadataArgsStorage;\n}\n\n/**\n * Reads connection options stored in ormconfig configuration file.\n */\nexport async function getConnectionOptions(connectionName: string = \"default\"): Promise<ConnectionOptions> {\n return new ConnectionOptionsReader().get(connectionName);\n}\n\n/**\n * Gets a ConnectionManager which creates connections.\n */\nexport function getConnectionManager(): ConnectionManager {\n return getFromContainer(ConnectionManager);\n}\n\n/**\n * Creates a new connection and registers it in the manager.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(): Promise<Connection>;\n\n/**\n * Creates a new connection from the ormconfig file with a given name.\n */\nexport async function createConnection(name: string): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n */\nexport async function createConnection(options: ConnectionOptions): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(optionsOrName?: any): Promise<Connection> {\n const connectionName = typeof optionsOrName === \"string\" ? optionsOrName : \"default\";\n const options = optionsOrName instanceof Object ? optionsOrName : await getConnectionOptions(connectionName);\n return getConnectionManager().create(options).connect();\n}\n\n/**\n * Creates new connections and registers them in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * All connections from the ormconfig will be created.\n */\nexport async function createConnections(options?: ConnectionOptions[]): Promise<Connection[]> {\n if (!options)\n options = await new ConnectionOptionsReader().all();\n const connections = options.map(options => getConnectionManager().create(options));\n return Promise.all(connections.map(connection => connection.connect()));\n}\n\n/**\n * Gets connection from the connection manager.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getConnection(connectionName: string = \"default\"): Connection {\n return getConnectionManager().get(connectionName);\n}\n\n/**\n * Gets entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getManager(connectionName: string = \"default\"): EntityManager {\n return getConnectionManager().get(connectionName).manager;\n}\n\n/**\n * Gets MongoDB entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getMongoManager(connectionName: string = \"default\"): MongoEntityManager {\n return getConnectionManager().get(connectionName).manager as MongoEntityManager;\n}\n\n/**\n * Gets Sqljs entity manager from connection name.\n * \"default\" connection is used, when no name is specified.\n * Only works when Sqljs driver is used.\n */\nexport function getSqljsManager(connectionName: string = \"default\"): SqljsEntityManager {\n return getConnectionManager().get(connectionName).manager as SqljsEntityManager;\n}\n\n/**\n * Gets repository for the given entity class.\n */\nexport function getRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): Repository<Entity> {\n return getConnectionManager().get(connectionName).getRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getTreeRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): TreeRepository<Entity> {\n return getConnectionManager().get(connectionName).getTreeRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName: string = \"default\"): T {\n return getConnectionManager().get(connectionName).getCustomRepository(customRepository);\n}\n\n/**\n * Gets mongodb repository for the given entity class or name.\n */\nexport function getMongoRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): MongoRepository<Entity> {\n return getConnectionManager().get(connectionName).getMongoRepository<Entity>(entityClass);\n}\n\n/**\n * Creates a new query builder.\n */\nexport function createQueryBuilder<Entity>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName: string = \"default\"): SelectQueryBuilder<Entity> {\n if (entityClass) {\n return getRepository(entityClass, connectionName).createQueryBuilder(alias);\n }\n\n return getConnection(connectionName).createQueryBuilder();\n}\n"],"sourceRoot":"."}
1
+ {"version":3,"sources":["../browser/src/globals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAY/C;;GAEG;AACH,MAAM,UAAU,sBAAsB;IAClC,8FAA8F;IAC9F,qGAAqG;IACrG,mGAAmG;IACnG,8EAA8E;IAC9E,6FAA6F;IAC7F,8FAA8F;IAC9F,iFAAiF;IACjF,4FAA4F;IAC5F,IAAM,WAAW,GAAG,aAAa,CAAC,iBAAiB,EAAE,CAAC;IACtD,IAAI,CAAC,WAAW,CAAC,0BAA0B;QACvC,WAAW,CAAC,0BAA0B,GAAG,IAAI,mBAAmB,EAAE,CAAC;IAEvE,OAAO,WAAW,CAAC,0BAA0B,CAAC;AAClD,CAAC;AAED;;GAEG;AACH,MAAM,UAAgB,oBAAoB,CAAC,cAAkC;IAAlC,+BAAA,EAAA,0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BAAA,EAAA,0BAAkC;IAC5G,OAAO,oBAAoB,EAAE,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,kBAAkB,CAAS,WAAW,CAAC,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAS,WAAkC,EAAE,KAAc,EAAE,cAAkC;IAAlC,+BAAA,EAAA,0BAAkC;IAC7H,IAAI,WAAW,EAAE;QACb,OAAO,aAAa,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;KAC/E;IAED,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC;AAC9D,CAAC","file":"globals.js","sourcesContent":["import { MetadataArgsStorage } from \"./metadata-args/MetadataArgsStorage\";\nimport { PlatformTools } from \"./platform/PlatformTools\";\nimport { ConnectionOptions } from \"./connection/ConnectionOptions\";\nimport { ConnectionOptionsReader } from \"./connection/ConnectionOptionsReader\";\nimport { ConnectionManager } from \"./connection/ConnectionManager\";\nimport { getFromContainer } from \"./container\";\nimport { Connection } from \"./connection/Connection\";\nimport { EntityManager } from \"./entity-manager/EntityManager\";\nimport { MongoEntityManager } from \"./entity-manager/MongoEntityManager\";\nimport { SqljsEntityManager } from \"./entity-manager/SqljsEntityManager\";\nimport { EntityTarget } from \"./common/EntityTarget\";\nimport { Repository } from \"./repository/Repository\";\nimport { TreeRepository } from \"./repository/TreeRepository\";\nimport { ObjectType } from \"./common/ObjectType\";\nimport { MongoRepository } from \"./repository/MongoRepository\";\nimport { SelectQueryBuilder } from \"./query-builder/SelectQueryBuilder\";\n\n/**\n * Gets metadata args storage.\n */\nexport function getMetadataArgsStorage(): MetadataArgsStorage {\n // we should store metadata storage in a global variable otherwise it brings too much problems\n // one of the problem is that if any entity (or any other) will be imported before consumer will call\n // useContainer method with his own container implementation, that entity will be registered in the\n // old old container (default one post probably) and consumer will his entity.\n // calling useContainer before he imports any entity (or any other) is not always convenient.\n // another reason is that when we run migrations typeorm is being called from a global package\n // and it may load entities which register decorators in typeorm of local package\n // this leads to impossibility of usage of entities in migrations and cli related operations\n const globalScope = PlatformTools.getGlobalVariable();\n if (!globalScope.typeormMetadataArgsStorage)\n globalScope.typeormMetadataArgsStorage = new MetadataArgsStorage();\n\n return globalScope.typeormMetadataArgsStorage;\n}\n\n/**\n * Reads connection options stored in ormconfig configuration file.\n */\nexport async function getConnectionOptions(connectionName: string = \"default\"): Promise<ConnectionOptions> {\n return new ConnectionOptionsReader().get(connectionName);\n}\n\n/**\n * Gets a ConnectionManager which creates connections.\n */\nexport function getConnectionManager(): ConnectionManager {\n return getFromContainer(ConnectionManager);\n}\n\n/**\n * Creates a new connection and registers it in the manager.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(): Promise<Connection>;\n\n/**\n * Creates a new connection from the ormconfig file with a given name.\n */\nexport async function createConnection(name: string): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n */\nexport async function createConnection(options: ConnectionOptions): Promise<Connection>;\n\n/**\n * Creates a new connection and registers it in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * Only one connection from ormconfig will be created (name \"default\" or connection without name).\n */\nexport async function createConnection(optionsOrName?: any): Promise<Connection> {\n const connectionName = typeof optionsOrName === \"string\" ? optionsOrName : \"default\";\n const options = optionsOrName instanceof Object ? optionsOrName : await getConnectionOptions(connectionName);\n return getConnectionManager().create(options).connect();\n}\n\n/**\n * Creates new connections and registers them in the manager.\n *\n * If connection options were not specified, then it will try to create connection automatically,\n * based on content of ormconfig (json/js/yml/xml/env) file or environment variables.\n * All connections from the ormconfig will be created.\n */\nexport async function createConnections(options?: ConnectionOptions[]): Promise<Connection[]> {\n if (!options)\n options = await new ConnectionOptionsReader().all();\n const connections = options.map(options => getConnectionManager().create(options));\n // Do not use Promise.all or test 8522 will produce a dangling sqlite connection\n for (const connection of connections) {\n await connection.connect()\n }\n return connections;\n}\n\n/**\n * Gets connection from the connection manager.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getConnection(connectionName: string = \"default\"): Connection {\n return getConnectionManager().get(connectionName);\n}\n\n/**\n * Gets entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getManager(connectionName: string = \"default\"): EntityManager {\n return getConnectionManager().get(connectionName).manager;\n}\n\n/**\n * Gets MongoDB entity manager from the connection.\n * If connection name wasn't specified, then \"default\" connection will be retrieved.\n */\nexport function getMongoManager(connectionName: string = \"default\"): MongoEntityManager {\n return getConnectionManager().get(connectionName).manager as MongoEntityManager;\n}\n\n/**\n * Gets Sqljs entity manager from connection name.\n * \"default\" connection is used, when no name is specified.\n * Only works when Sqljs driver is used.\n */\nexport function getSqljsManager(connectionName: string = \"default\"): SqljsEntityManager {\n return getConnectionManager().get(connectionName).manager as SqljsEntityManager;\n}\n\n/**\n * Gets repository for the given entity class.\n */\nexport function getRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): Repository<Entity> {\n return getConnectionManager().get(connectionName).getRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getTreeRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): TreeRepository<Entity> {\n return getConnectionManager().get(connectionName).getTreeRepository<Entity>(entityClass);\n}\n\n/**\n * Gets tree repository for the given entity class.\n */\nexport function getCustomRepository<T>(customRepository: ObjectType<T>, connectionName: string = \"default\"): T {\n return getConnectionManager().get(connectionName).getCustomRepository(customRepository);\n}\n\n/**\n * Gets mongodb repository for the given entity class or name.\n */\nexport function getMongoRepository<Entity>(entityClass: EntityTarget<Entity>, connectionName: string = \"default\"): MongoRepository<Entity> {\n return getConnectionManager().get(connectionName).getMongoRepository<Entity>(entityClass);\n}\n\n/**\n * Creates a new query builder.\n */\nexport function createQueryBuilder<Entity>(entityClass?: EntityTarget<Entity>, alias?: string, connectionName: string = \"default\"): SelectQueryBuilder<Entity> {\n if (entityClass) {\n return getRepository(entityClass, connectionName).createQueryBuilder(alias);\n }\n\n return getConnection(connectionName).createQueryBuilder();\n}\n"],"sourceRoot":"."}
@@ -7,6 +7,7 @@ export * from "./common/EntityTarget";
7
7
  export * from "./common/ObjectType";
8
8
  export * from "./common/ObjectLiteral";
9
9
  export * from "./common/DeepPartial";
10
+ export * from "./common/RelationType";
10
11
  export * from "./error";
11
12
  export * from "./decorator/columns/Column";
12
13
  export * from "./decorator/columns/CreateDateColumn";
package/browser/index.js CHANGED
@@ -10,6 +10,7 @@ export * from "./common/EntityTarget";
10
10
  export * from "./common/ObjectType";
11
11
  export * from "./common/ObjectLiteral";
12
12
  export * from "./common/DeepPartial";
13
+ export * from "./common/RelationType";
13
14
  export * from "./error";
14
15
  export * from "./decorator/columns/Column";
15
16
  export * from "./decorator/columns/CreateDateColumn";
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/index.ts"],"names":[],"mappings":"AAAA;GACG;AACH,OAAO,kBAAkB,CAAC;AAE1B,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,sCAAsC,CAAC;AACrD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,mCAAmC,CAAC;AAClD,cA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CAAC;AAC7E,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AAGjE,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,kBAAkB,EAAC,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,QAAQ,EAAC,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,6BAA6B,CAAC;AAGxD,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,YAAY,EAAC,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAY9E,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\";\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\";\nexport * from \"./container\";\nexport * from \"./common/EntityTarget\";\nexport * from \"./common/ObjectType\";\nexport * from \"./common/ObjectLiteral\";\nexport * from \"./common/DeepPartial\";\nexport * from \"./error\";\nexport * from \"./decorator/columns/Column\";\nexport * from \"./decorator/columns/CreateDateColumn\";\nexport * from \"./decorator/columns/DeleteDateColumn\";\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\";\nexport * from \"./decorator/columns/PrimaryColumn\";\nexport * from \"./decorator/columns/UpdateDateColumn\";\nexport * from \"./decorator/columns/VersionColumn\";\nexport * from \"./decorator/columns/ViewColumn\";\nexport * from \"./decorator/columns/ObjectIdColumn\";\nexport * from \"./decorator/listeners/AfterInsert\";\nexport * from \"./decorator/listeners/AfterLoad\";\nexport * from \"./decorator/listeners/AfterRemove\";\nexport * from \"./decorator/listeners/AfterUpdate\";\nexport * from \"./decorator/listeners/BeforeInsert\";\nexport * from \"./decorator/listeners/BeforeRemove\";\nexport * from \"./decorator/listeners/BeforeUpdate\";\nexport * from \"./decorator/listeners/EventSubscriber\";\nexport * from \"./decorator/options/ColumnOptions\";\nexport * from \"./decorator/options/IndexOptions\";\nexport * from \"./decorator/options/JoinColumnOptions\";\nexport * from \"./decorator/options/JoinTableOptions\";\nexport * from \"./decorator/options/RelationOptions\";\nexport * from \"./decorator/options/EntityOptions\";\nexport * from \"./decorator/options/ValueTransformer\";\nexport * from \"./decorator/relations/JoinColumn\";\nexport * from \"./decorator/relations/JoinTable\";\nexport * from \"./decorator/relations/ManyToMany\";\nexport * from \"./decorator/relations/ManyToOne\";\nexport * from \"./decorator/relations/OneToMany\";\nexport * from \"./decorator/relations/OneToOne\";\nexport * from \"./decorator/relations/RelationCount\";\nexport * from \"./decorator/relations/RelationId\";\nexport * from \"./decorator/entity/Entity\";\nexport * from \"./decorator/entity/ChildEntity\";\nexport * from \"./decorator/entity/TableInheritance\";\nexport * from \"./decorator/entity-view/ViewEntity\";\nexport * from \"./decorator/transaction/Transaction\";\nexport * from \"./decorator/transaction/TransactionManager\";\nexport * from \"./decorator/transaction/TransactionRepository\";\nexport * from \"./decorator/tree/TreeLevelColumn\";\nexport * from \"./decorator/tree/TreeParent\";\nexport * from \"./decorator/tree/TreeChildren\";\nexport * from \"./decorator/tree/Tree\";\nexport * from \"./decorator/Index\";\nexport * from \"./decorator/Unique\";\nexport * from \"./decorator/Check\";\nexport * from \"./decorator/Exclusion\";\nexport * from \"./decorator/Generated\";\nexport * from \"./decorator/EntityRepository\";\nexport * from \"./find-options/operator/Any\";\nexport * from \"./find-options/operator/Between\";\nexport * from \"./find-options/operator/Equal\";\nexport * from \"./find-options/operator/In\";\nexport * from \"./find-options/operator/IsNull\";\nexport * from \"./find-options/operator/LessThan\";\nexport * from \"./find-options/operator/LessThanOrEqual\";\nexport * from \"./find-options/operator/ILike\";\nexport * from \"./find-options/operator/Like\";\nexport * from \"./find-options/operator/MoreThan\";\nexport * from \"./find-options/operator/MoreThanOrEqual\";\nexport * from \"./find-options/operator/Not\";\nexport * from \"./find-options/operator/Raw\";\nexport * from \"./find-options/FindConditions\";\nexport * from \"./find-options/FindManyOptions\";\nexport * from \"./find-options/FindOneOptions\";\nexport * from \"./find-options/FindOperator\";\nexport * from \"./find-options/FindOperatorType\";\nexport * from \"./find-options/JoinOptions\";\nexport * from \"./find-options/OrderByCondition\";\nexport * from \"./find-options/FindOptionsUtils\";\nexport * from \"./logger/Logger\";\nexport * from \"./logger/LoggerOptions\";\nexport * from \"./logger/AdvancedConsoleLogger\";\nexport * from \"./logger/SimpleConsoleLogger\";\nexport * from \"./logger/FileLogger\";\nexport * from \"./metadata/EntityMetadata\";\nexport * from \"./entity-manager/EntityManager\";\nexport * from \"./repository/AbstractRepository\";\nexport * from \"./repository/Repository\";\nexport * from \"./repository/BaseEntity\";\nexport * from \"./repository/TreeRepository\";\nexport * from \"./repository/MongoRepository\";\nexport * from \"./repository/RemoveOptions\";\nexport * from \"./repository/SaveOptions\";\nexport * from \"./schema-builder/table/TableCheck\";\nexport * from \"./schema-builder/table/TableColumn\";\nexport * from \"./schema-builder/table/TableExclusion\";\nexport * from \"./schema-builder/table/TableForeignKey\";\nexport * from \"./schema-builder/table/TableIndex\";\nexport * from \"./schema-builder/table/TableUnique\";\nexport * from \"./schema-builder/table/Table\";\nexport * from \"./schema-builder/options/TableCheckOptions\";\nexport * from \"./schema-builder/options/TableColumnOptions\";\nexport * from \"./schema-builder/options/TableExclusionOptions\";\nexport * from \"./schema-builder/options/TableForeignKeyOptions\";\nexport * from \"./schema-builder/options/TableIndexOptions\";\nexport * from \"./schema-builder/options/TableOptions\";\nexport * from \"./schema-builder/options/TableUniqueOptions\";\nexport * from \"./schema-builder/options/ViewOptions\";\nexport * from \"./driver/mongodb/typings\";\nexport * from \"./driver/types/DatabaseType\";\nexport * from \"./driver/types/ReplicationMode\";\nexport * from \"./driver/sqlserver/MssqlParameter\";\n\nexport {ConnectionOptionsReader} from \"./connection/ConnectionOptionsReader\";\nexport {Connection} from \"./connection/Connection\";\nexport {ConnectionManager} from \"./connection/ConnectionManager\";\nexport {ConnectionOptions} from \"./connection/ConnectionOptions\";\nexport {Driver} from \"./driver/Driver\";\nexport {QueryBuilder} from \"./query-builder/QueryBuilder\";\nexport {SelectQueryBuilder} from \"./query-builder/SelectQueryBuilder\";\nexport {DeleteQueryBuilder} from \"./query-builder/DeleteQueryBuilder\";\nexport {InsertQueryBuilder} from \"./query-builder/InsertQueryBuilder\";\nexport {UpdateQueryBuilder} from \"./query-builder/UpdateQueryBuilder\";\nexport {RelationQueryBuilder} from \"./query-builder/RelationQueryBuilder\";\nexport {Brackets} from \"./query-builder/Brackets\";\nexport {NotBrackets} from \"./query-builder/NotBrackets\";\nexport {WhereExpressionBuilder} from \"./query-builder/WhereExpressionBuilder\";\nexport {WhereExpression} from \"./query-builder/WhereExpressionBuilder\";\nexport {InsertResult} from \"./query-builder/result/InsertResult\";\nexport {UpdateResult} from \"./query-builder/result/UpdateResult\";\nexport {DeleteResult} from \"./query-builder/result/DeleteResult\";\nexport {QueryResult} from \"./query-runner/QueryResult\";\nexport {QueryRunner} from \"./query-runner/QueryRunner\";\nexport {MongoEntityManager} from \"./entity-manager/MongoEntityManager\";\nexport {Migration} from \"./migration/Migration\";\nexport {MigrationExecutor} from \"./migration/MigrationExecutor\";\nexport {MigrationInterface} from \"./migration/MigrationInterface\";\nexport {DefaultNamingStrategy} from \"./naming-strategy/DefaultNamingStrategy\";\nexport {NamingStrategyInterface} from \"./naming-strategy/NamingStrategyInterface\";\nexport {FindOneOptions} from \"./find-options/FindOneOptions\";\nexport {FindManyOptions} from \"./find-options/FindManyOptions\";\nexport {InsertEvent} from \"./subscriber/event/InsertEvent\";\nexport {LoadEvent} from \"./subscriber/event/LoadEvent\";\nexport {UpdateEvent} from \"./subscriber/event/UpdateEvent\";\nexport {RemoveEvent} from \"./subscriber/event/RemoveEvent\";\nexport {TransactionCommitEvent} from \"./subscriber/event/TransactionCommitEvent\";\nexport {TransactionRollbackEvent} from \"./subscriber/event/TransactionRollbackEvent\";\nexport {TransactionStartEvent} from \"./subscriber/event/TransactionStartEvent\";\nexport {EntitySubscriberInterface} from \"./subscriber/EntitySubscriberInterface\";\nexport {EntitySchema} from \"./entity-schema/EntitySchema\";\nexport {EntitySchemaColumnOptions} from \"./entity-schema/EntitySchemaColumnOptions\";\nexport {EntitySchemaIndexOptions} from \"./entity-schema/EntitySchemaIndexOptions\";\nexport {EntitySchemaRelationOptions} from \"./entity-schema/EntitySchemaRelationOptions\";\nexport {ColumnType} from \"./driver/types/ColumnTypes\";\n"],"sourceRoot":"."}
1
+ {"version":3,"sources":["../browser/src/index.ts"],"names":[],"mappings":"AAAA;GACG;AACH,OAAO,kBAAkB,CAAC;AAE1B,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,C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,MAAM,yCAAyC,CAAC;AAY9E,OAAO,EAAC,YAAY,EAAC,MAAM,8BAA8B,CAAC","file":"index.js","sourcesContent":["/*!\n */\nimport \"reflect-metadata\";\n\n// -------------------------------------------------------------------------\n// Commonly Used exports\n// -------------------------------------------------------------------------\n\nexport * from \"./globals\";\nexport * from \"./container\";\nexport * from \"./common/EntityTarget\";\nexport * from \"./common/ObjectType\";\nexport * from \"./common/ObjectLiteral\";\nexport * from \"./common/DeepPartial\";\nexport * from \"./common/RelationType\";\nexport * from \"./error\";\nexport * from \"./decorator/columns/Column\";\nexport * from \"./decorator/columns/CreateDateColumn\";\nexport * from \"./decorator/columns/DeleteDateColumn\";\nexport * from \"./decorator/columns/PrimaryGeneratedColumn\";\nexport * from \"./decorator/columns/PrimaryColumn\";\nexport * from \"./decorator/columns/UpdateDateColumn\";\nexport * from \"./decorator/columns/VersionColumn\";\nexport * from \"./decorator/columns/ViewColumn\";\nexport * from \"./decorator/columns/ObjectIdColumn\";\nexport * from \"./decorator/listeners/AfterInsert\";\nexport * from \"./decorator/listeners/AfterLoad\";\nexport * from \"./decorator/listeners/AfterRemove\";\nexport * from \"./decorator/listeners/AfterUpdate\";\nexport * from \"./decorator/listeners/BeforeInsert\";\nexport * from \"./decorator/listeners/BeforeRemove\";\nexport * from \"./decorator/listeners/BeforeUpdate\";\nexport * from \"./decorator/listeners/EventSubscriber\";\nexport * from \"./decorator/options/ColumnOptions\";\nexport * from \"./decorator/options/IndexOptions\";\nexport * from \"./decorator/options/JoinColumnOptions\";\nexport * from \"./decorator/options/JoinTableOptions\";\nexport * from \"./decorator/options/RelationOptions\";\nexport * from \"./decorator/options/EntityOptions\";\nexport * from \"./decorator/options/ValueTransformer\";\nexport * from \"./decorator/relations/JoinColumn\";\nexport * from \"./decorator/relations/JoinTable\";\nexport * from \"./decorator/relations/ManyToMany\";\nexport * from \"./decorator/relations/ManyToOne\";\nexport * from \"./decorator/relations/OneToMany\";\nexport * from \"./decorator/relations/OneToOne\";\nexport * from \"./decorator/relations/RelationCount\";\nexport * from \"./decorator/relations/RelationId\";\nexport * from \"./decorator/entity/Entity\";\nexport * from \"./decorator/entity/ChildEntity\";\nexport * from \"./decorator/entity/TableInheritance\";\nexport * from \"./decorator/entity-view/ViewEntity\";\nexport * from \"./decorator/transaction/Transaction\";\nexport * from \"./decorator/transaction/TransactionManager\";\nexport * from \"./decorator/transaction/TransactionRepository\";\nexport * from \"./decorator/tree/TreeLevelColumn\";\nexport * from \"./decorator/tree/TreeParent\";\nexport * from \"./decorator/tree/TreeChildren\";\nexport * from \"./decorator/tree/Tree\";\nexport * from \"./decorator/Index\";\nexport * from \"./decorator/Unique\";\nexport * from \"./decorator/Check\";\nexport * from \"./decorator/Exclusion\";\nexport * from \"./decorator/Generated\";\nexport * from \"./decorator/EntityRepository\";\nexport * from \"./find-options/operator/Any\";\nexport * from \"./find-options/operator/Between\";\nexport * from \"./find-options/operator/Equal\";\nexport * from \"./find-options/operator/In\";\nexport * from \"./find-options/operator/IsNull\";\nexport * from \"./find-options/operator/LessThan\";\nexport * from \"./find-options/operator/LessThanOrEqual\";\nexport * from \"./find-options/operator/ILike\";\nexport * from \"./find-options/operator/Like\";\nexport * from \"./find-options/operator/MoreThan\";\nexport * from \"./find-options/operator/MoreThanOrEqual\";\nexport * from \"./find-options/operator/Not\";\nexport * from \"./find-options/operator/Raw\";\nexport * from \"./find-options/FindConditions\";\nexport * from \"./find-options/FindManyOptions\";\nexport * from \"./find-options/FindOneOptions\";\nexport * from \"./find-options/FindOperator\";\nexport * from \"./find-options/FindOperatorType\";\nexport * from \"./find-options/JoinOptions\";\nexport * from \"./find-options/OrderByCondition\";\nexport * from \"./find-options/FindOptionsUtils\";\nexport * from \"./logger/Logger\";\nexport * from \"./logger/LoggerOptions\";\nexport * from \"./logger/AdvancedConsoleLogger\";\nexport * from \"./logger/SimpleConsoleLogger\";\nexport * from \"./logger/FileLogger\";\nexport * from \"./metadata/EntityMetadata\";\nexport * from \"./entity-manager/EntityManager\";\nexport * from \"./repository/AbstractRepository\";\nexport * from \"./repository/Repository\";\nexport * from \"./repository/BaseEntity\";\nexport * from \"./repository/TreeRepository\";\nexport * from \"./repository/MongoRepository\";\nexport * from \"./repository/RemoveOptions\";\nexport * from \"./repository/SaveOptions\";\nexport * from \"./schema-builder/table/TableCheck\";\nexport * from \"./schema-builder/table/TableColumn\";\nexport * from \"./schema-builder/table/TableExclusion\";\nexport * from \"./schema-builder/table/TableForeignKey\";\nexport * from \"./schema-builder/table/TableIndex\";\nexport * from \"./schema-builder/table/TableUnique\";\nexport * from \"./schema-builder/table/Table\";\nexport * from \"./schema-builder/options/TableCheckOptions\";\nexport * from \"./schema-builder/options/TableColumnOptions\";\nexport * from \"./schema-builder/options/TableExclusionOptions\";\nexport * from \"./schema-builder/options/TableForeignKeyOptions\";\nexport * from \"./schema-builder/options/TableIndexOptions\";\nexport * from \"./schema-builder/options/TableOptions\";\nexport * from \"./schema-builder/options/TableUniqueOptions\";\nexport * from \"./schema-builder/options/ViewOptions\";\nexport * from \"./driver/mongodb/typings\";\nexport * from \"./driver/types/DatabaseType\";\nexport * from \"./driver/types/ReplicationMode\";\nexport * from \"./driver/sqlserver/MssqlParameter\";\n\nexport {ConnectionOptionsReader} from \"./connection/ConnectionOptionsReader\";\nexport {Connection} from \"./connection/Connection\";\nexport {ConnectionManager} from \"./connection/ConnectionManager\";\nexport {ConnectionOptions} from \"./connection/ConnectionOptions\";\nexport {Driver} from \"./driver/Driver\";\nexport {QueryBuilder} from \"./query-builder/QueryBuilder\";\nexport {SelectQueryBuilder} from \"./query-builder/SelectQueryBuilder\";\nexport {DeleteQueryBuilder} from \"./query-builder/DeleteQueryBuilder\";\nexport {InsertQueryBuilder} from \"./query-builder/InsertQueryBuilder\";\nexport {UpdateQueryBuilder} from \"./query-builder/UpdateQueryBuilder\";\nexport {RelationQueryBuilder} from \"./query-builder/RelationQueryBuilder\";\nexport {Brackets} from \"./query-builder/Brackets\";\nexport {NotBrackets} from \"./query-builder/NotBrackets\";\nexport {WhereExpressionBuilder} from \"./query-builder/WhereExpressionBuilder\";\nexport {WhereExpression} from \"./query-builder/WhereExpressionBuilder\";\nexport {InsertResult} from \"./query-builder/result/InsertResult\";\nexport {UpdateResult} from \"./query-builder/result/UpdateResult\";\nexport {DeleteResult} from \"./query-builder/result/DeleteResult\";\nexport {QueryResult} from \"./query-runner/QueryResult\";\nexport {QueryRunner} from \"./query-runner/QueryRunner\";\nexport {MongoEntityManager} from \"./entity-manager/MongoEntityManager\";\nexport {Migration} from \"./migration/Migration\";\nexport {MigrationExecutor} from \"./migration/MigrationExecutor\";\nexport {MigrationInterface} from \"./migration/MigrationInterface\";\nexport {DefaultNamingStrategy} from \"./naming-strategy/DefaultNamingStrategy\";\nexport {NamingStrategyInterface} from \"./naming-strategy/NamingStrategyInterface\";\nexport {FindOneOptions} from \"./find-options/FindOneOptions\";\nexport {FindManyOptions} from \"./find-options/FindManyOptions\";\nexport {InsertEvent} from \"./subscriber/event/InsertEvent\";\nexport {LoadEvent} from \"./subscriber/event/LoadEvent\";\nexport {UpdateEvent} from \"./subscriber/event/UpdateEvent\";\nexport {RemoveEvent} from \"./subscriber/event/RemoveEvent\";\nexport {TransactionCommitEvent} from \"./subscriber/event/TransactionCommitEvent\";\nexport {TransactionRollbackEvent} from \"./subscriber/event/TransactionRollbackEvent\";\nexport {TransactionStartEvent} from \"./subscriber/event/TransactionStartEvent\";\nexport {EntitySubscriberInterface} from \"./subscriber/EntitySubscriberInterface\";\nexport {EntitySchema} from \"./entity-schema/EntitySchema\";\nexport {EntitySchemaColumnOptions} from \"./entity-schema/EntitySchemaColumnOptions\";\nexport {EntitySchemaIndexOptions} from \"./entity-schema/EntitySchemaIndexOptions\";\nexport {EntitySchemaRelationOptions} from \"./entity-schema/EntitySchemaRelationOptions\";\nexport {ColumnType} from \"./driver/types/ColumnTypes\";\n"],"sourceRoot":"."}
@@ -42,7 +42,9 @@ export declare class DeleteQueryBuilder<Entity> extends QueryBuilder<Entity> imp
42
42
  */
43
43
  orWhere(where: Brackets | string | ((qb: this) => string) | ObjectLiteral | ObjectLiteral[], parameters?: ObjectLiteral): this;
44
44
  /**
45
- * Adds new AND WHERE with conditions for the given ids.
45
+ * Sets WHERE condition in the query builder with a condition for the given ids.
46
+ * If you had previously WHERE expression defined,
47
+ * calling this function will override previously set WHERE conditions.
46
48
  */
47
49
  whereInIds(ids: any | any[]): this;
48
50
  /**
@@ -148,7 +148,9 @@ var DeleteQueryBuilder = /** @class */ (function (_super) {
148
148
  return this;
149
149
  };
150
150
  /**
151
- * Adds new AND WHERE with conditions for the given ids.
151
+ * Sets WHERE condition in the query builder with a condition for the given ids.
152
+ * If you had previously WHERE expression defined,
153
+ * calling this function will override previously set WHERE conditions.
152
154
  */
153
155
  DeleteQueryBuilder.prototype.whereInIds = function (ids) {
154
156
  return this.where(this.getWhereInIdsCondition(ids));
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/query-builder/DeleteQueryBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAK5C,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAGjE,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,mCAAmC,EAAC,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH;IAAgD,sCAAoB;IAEhE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,4BAAY,wBAAsD,EAAE,WAAyB;QAA7F,YACI,kBAAM,wBAA+B,EAAE,WAAW,CAAC,SAEtD;QADG,KAAI,CAAC,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;;IACzD,CAAC;IAED,4EAA4E;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OAEG;IACH,mCAAM,GAAN,UAAO,MAAuB;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAmBD;;OAEG;IACH,sCAAS,GAAT,UAAU,SAA0B;QAEhC,mDAAmD;QACnD,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,uBAAuB,EAAE;YACjD,MAAM,IAAI,mCAAmC,EAAE,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;OAEG;IACO,mDAAsB,GAAhC;QACI,IAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC7D,IAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACrD,IAAM,mBAAmB,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAE7D,IAAI,mBAAmB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,eAAe,CAAC,EAAE;YAChI,OAAO,iBAAe,SAAS,GAAG,eAAe,mBAAc,mBAAqB,CAAC;SAExF;aAAM,IAAI,mBAAmB,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,eAAe,EAAE;YACxF,OAAO,iBAAe,SAAS,gBAAW,mBAAmB,GAAG,eAAiB,CAAC;SAErF;aAAM;YACH,OAAO,iBAAe,SAAS,GAAG,eAAiB,CAAC;SACvD;IACL,CAAC;IAEL,yBAAC;AAAD,CAjOA,AAiOC,CAjO+C,YAAY,GAiO3D","file":"DeleteQueryBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {QueryBuilder} from \"./QueryBuilder\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {Connection} from \"../connection/Connection\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {WhereExpressionBuilder} from \"./WhereExpressionBuilder\";\nimport {Brackets} from \"./Brackets\";\nimport {DeleteResult} from \"./result/DeleteResult\";\nimport {ReturningStatementNotSupportedError} from \"../error/ReturningStatementNotSupportedError\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\n\n/**\n * Allows to build complex sql queries in a fashion way and execute those queries.\n */\nexport class DeleteQueryBuilder<Entity> extends QueryBuilder<Entity> implements WhereExpressionBuilder {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connectionOrQueryBuilder: Connection|QueryBuilder<any>, queryRunner?: QueryRunner) {\n super(connectionOrQueryBuilder as any, queryRunner);\n this.expressionMap.aliasNamePrefixingEnabled = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Gets generated SQL query without parameters being replaced.\n */\n getQuery(): string {\n let sql = this.createComment();\n sql += this.createDeleteExpression();\n return sql.trim();\n }\n\n /**\n * Executes sql generated by query builder and returns raw database results.\n */\n async execute(): Promise<DeleteResult> {\n const [sql, parameters] = this.getQueryAndParameters();\n const queryRunner = this.obtainQueryRunner();\n let transactionStartedByUs: boolean = false;\n\n try {\n\n // start transaction if it was enabled\n if (this.expressionMap.useTransaction === true && queryRunner.isTransactionActive === false) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n // call before deletion methods in listeners and subscribers\n if (this.expressionMap.callListeners === true && this.expressionMap.mainAlias!.hasMetadata) {\n await queryRunner.broadcaster.broadcast(\"BeforeRemove\", this.expressionMap.mainAlias!.metadata);\n }\n\n // execute query\n const queryResult = await queryRunner.query(sql, parameters, true);\n const deleteResult = DeleteResult.from(queryResult);\n\n // call after deletion methods in listeners and subscribers\n if (this.expressionMap.callListeners === true && this.expressionMap.mainAlias!.hasMetadata) {\n await queryRunner.broadcaster.broadcast(\"AfterRemove\", this.expressionMap.mainAlias!.metadata);\n }\n\n // close transaction if we started it\n if (transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n return deleteResult;\n\n } catch (error) {\n\n // rollback transaction if we started it\n if (transactionStartedByUs) {\n try {\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n throw error;\n\n } finally {\n if (queryRunner !== this.queryRunner) { // means we created our own query runner\n await queryRunner.release();\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Specifies FROM which entity's table select/update/delete will be executed.\n * Also sets a main string alias of the selection data.\n */\n from<T>(entityTarget: EntityTarget<T>, aliasName?: string): DeleteQueryBuilder<T> {\n entityTarget = entityTarget instanceof EntitySchema ? entityTarget.options.name : entityTarget;\n const mainAlias = this.createFromAlias(entityTarget, aliasName);\n this.expressionMap.setMainAlias(mainAlias);\n return (this as any) as DeleteQueryBuilder<T>;\n }\n\n /**\n * Sets WHERE condition in the query builder.\n * If you had previously WHERE expression defined,\n * calling this function will override previously set WHERE conditions.\n * Additionally you can add parameters used in where expression.\n */\n where(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres = []; // don't move this block below since computeWhereParameter can add where expressions\n const condition = this.getWhereCondition(where);\n if (condition)\n this.expressionMap.wheres = [{ type: \"simple\", condition: condition }];\n if (parameters)\n this.setParameters(parameters);\n return this;\n }\n\n /**\n * Adds new AND WHERE condition in the query builder.\n * Additionally you can add parameters used in where expression.\n */\n andWhere(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres.push({ type: \"and\", condition: this.getWhereCondition(where) });\n if (parameters) this.setParameters(parameters);\n return this;\n }\n\n /**\n * Adds new OR WHERE condition in the query builder.\n * Additionally you can add parameters used in where expression.\n */\n orWhere(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres.push({ type: \"or\", condition: this.getWhereCondition(where) });\n if (parameters) this.setParameters(parameters);\n return this;\n }\n\n /**\n * Adds new AND WHERE with conditions for the given ids.\n */\n whereInIds(ids: any|any[]): this {\n return this.where(this.getWhereInIdsCondition(ids));\n }\n\n /**\n * Adds new AND WHERE with conditions for the given ids.\n */\n andWhereInIds(ids: any|any[]): this {\n return this.andWhere(this.getWhereInIdsCondition(ids));\n }\n\n /**\n * Adds new OR WHERE with conditions for the given ids.\n */\n orWhereInIds(ids: any|any[]): this {\n return this.orWhere(this.getWhereInIdsCondition(ids));\n }\n /**\n * Optional returning/output clause.\n * This will return given column values.\n */\n output(columns: string[]): this;\n\n /**\n * Optional returning/output clause.\n * Returning is a SQL string containing returning statement.\n */\n output(output: string): this;\n\n /**\n * Optional returning/output clause.\n */\n output(output: string|string[]): this;\n\n /**\n * Optional returning/output clause.\n */\n output(output: string|string[]): this {\n return this.returning(output);\n }\n\n /**\n * Optional returning/output clause.\n * This will return given column values.\n */\n returning(columns: string[]): this;\n\n /**\n * Optional returning/output clause.\n * Returning is a SQL string containing returning statement.\n */\n returning(returning: string): this;\n\n /**\n * Optional returning/output clause.\n */\n returning(returning: string|string[]): this;\n\n /**\n * Optional returning/output clause.\n */\n returning(returning: string|string[]): this {\n\n // not all databases support returning/output cause\n if (!this.connection.driver.isReturningSqlSupported())\n throw new ReturningStatementNotSupportedError();\n\n this.expressionMap.returning = returning;\n return this;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates DELETE express used to perform query.\n */\n protected createDeleteExpression() {\n const tableName = this.getTableName(this.getMainTableName());\n const whereExpression = this.createWhereExpression();\n const returningExpression = this.createReturningExpression();\n\n if (returningExpression && (this.connection.driver instanceof PostgresDriver || this.connection.driver instanceof CockroachDriver)) {\n return `DELETE FROM ${tableName}${whereExpression} RETURNING ${returningExpression}`;\n\n } else if (returningExpression !== \"\" && this.connection.driver instanceof SqlServerDriver) {\n return `DELETE FROM ${tableName} OUTPUT ${returningExpression}${whereExpression}`;\n\n } else {\n return `DELETE FROM ${tableName}${whereExpression}`;\n }\n }\n\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/query-builder/DeleteQueryBuilder.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAK5C,OAAO,EAAC,eAAe,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAC,cAAc,EAAC,MAAM,mCAAmC,CAAC;AAGjE,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,mCAAmC,EAAC,MAAM,8CAA8C,CAAC;AACjG,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D;;GAEG;AACH;IAAgD,sCAAoB;IAEhE,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,4BAAY,wBAAsD,EAAE,WAAyB;QAA7F,YACI,kBAAM,wBAA+B,EAAE,WAAW,CAAC,SAEtD;QADG,KAAI,CAAC,aAAa,CAAC,yBAAyB,GAAG,KAAK,CAAC;;IACzD,CAAC;IAED,4EAA4E;IAC5E,6BAA6B;IAC7B,4EAA4E;IAE5E;;OAEG;IACH,qCAAQ,GAAR;QACI,IAAI,GAAG,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QAC/B,GAAG,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;QACrC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;IACtB,CAAC;IAED;;OAEG;IACG,oCAAO,GAAb;;;;;;wBACU,KAAA,OAAoB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EpD,IAAI,CAAC,aAAa,CAAC,SAAS,GAAG,SAAS,CAAC;QACzC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;OAEG;IACO,mDAAsB,GAAhC;QACI,IAAM,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;QAC7D,IAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACrD,IAAM,mBAAmB,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAE7D,IAAI,mBAAmB,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,cAAc,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,eAAe,CAAC,EAAE;YAChI,OAAO,iBAAe,SAAS,GAAG,eAAe,mBAAc,mBAAqB,CAAC;SAExF;aAAM,IAAI,mBAAmB,KAAK,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,YAAY,eAAe,EAAE;YACxF,OAAO,iBAAe,SAAS,gBAAW,mBAAmB,GAAG,eAAiB,CAAC;SAErF;aAAM;YACH,OAAO,iBAAe,SAAS,GAAG,eAAiB,CAAC;SACvD;IACL,CAAC;IAEL,yBAAC;AAAD,CAnOA,AAmOC,CAnO+C,YAAY,GAmO3D","file":"DeleteQueryBuilder.js","sourcesContent":["import {CockroachDriver} from \"../driver/cockroachdb/CockroachDriver\";\nimport {QueryBuilder} from \"./QueryBuilder\";\nimport {ObjectLiteral} from \"../common/ObjectLiteral\";\nimport {EntityTarget} from \"../common/EntityTarget\";\nimport {Connection} from \"../connection/Connection\";\nimport {QueryRunner} from \"../query-runner/QueryRunner\";\nimport {SqlServerDriver} from \"../driver/sqlserver/SqlServerDriver\";\nimport {PostgresDriver} from \"../driver/postgres/PostgresDriver\";\nimport {WhereExpressionBuilder} from \"./WhereExpressionBuilder\";\nimport {Brackets} from \"./Brackets\";\nimport {DeleteResult} from \"./result/DeleteResult\";\nimport {ReturningStatementNotSupportedError} from \"../error/ReturningStatementNotSupportedError\";\nimport {EntitySchema} from \"../entity-schema/EntitySchema\";\n\n/**\n * Allows to build complex sql queries in a fashion way and execute those queries.\n */\nexport class DeleteQueryBuilder<Entity> extends QueryBuilder<Entity> implements WhereExpressionBuilder {\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connectionOrQueryBuilder: Connection|QueryBuilder<any>, queryRunner?: QueryRunner) {\n super(connectionOrQueryBuilder as any, queryRunner);\n this.expressionMap.aliasNamePrefixingEnabled = false;\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Gets generated SQL query without parameters being replaced.\n */\n getQuery(): string {\n let sql = this.createComment();\n sql += this.createDeleteExpression();\n return sql.trim();\n }\n\n /**\n * Executes sql generated by query builder and returns raw database results.\n */\n async execute(): Promise<DeleteResult> {\n const [sql, parameters] = this.getQueryAndParameters();\n const queryRunner = this.obtainQueryRunner();\n let transactionStartedByUs: boolean = false;\n\n try {\n\n // start transaction if it was enabled\n if (this.expressionMap.useTransaction === true && queryRunner.isTransactionActive === false) {\n await queryRunner.startTransaction();\n transactionStartedByUs = true;\n }\n\n // call before deletion methods in listeners and subscribers\n if (this.expressionMap.callListeners === true && this.expressionMap.mainAlias!.hasMetadata) {\n await queryRunner.broadcaster.broadcast(\"BeforeRemove\", this.expressionMap.mainAlias!.metadata);\n }\n\n // execute query\n const queryResult = await queryRunner.query(sql, parameters, true);\n const deleteResult = DeleteResult.from(queryResult);\n\n // call after deletion methods in listeners and subscribers\n if (this.expressionMap.callListeners === true && this.expressionMap.mainAlias!.hasMetadata) {\n await queryRunner.broadcaster.broadcast(\"AfterRemove\", this.expressionMap.mainAlias!.metadata);\n }\n\n // close transaction if we started it\n if (transactionStartedByUs)\n await queryRunner.commitTransaction();\n\n return deleteResult;\n\n } catch (error) {\n\n // rollback transaction if we started it\n if (transactionStartedByUs) {\n try {\n await queryRunner.rollbackTransaction();\n } catch (rollbackError) { }\n }\n throw error;\n\n } finally {\n if (queryRunner !== this.queryRunner) { // means we created our own query runner\n await queryRunner.release();\n }\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Specifies FROM which entity's table select/update/delete will be executed.\n * Also sets a main string alias of the selection data.\n */\n from<T>(entityTarget: EntityTarget<T>, aliasName?: string): DeleteQueryBuilder<T> {\n entityTarget = entityTarget instanceof EntitySchema ? entityTarget.options.name : entityTarget;\n const mainAlias = this.createFromAlias(entityTarget, aliasName);\n this.expressionMap.setMainAlias(mainAlias);\n return (this as any) as DeleteQueryBuilder<T>;\n }\n\n /**\n * Sets WHERE condition in the query builder.\n * If you had previously WHERE expression defined,\n * calling this function will override previously set WHERE conditions.\n * Additionally you can add parameters used in where expression.\n */\n where(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres = []; // don't move this block below since computeWhereParameter can add where expressions\n const condition = this.getWhereCondition(where);\n if (condition)\n this.expressionMap.wheres = [{ type: \"simple\", condition: condition }];\n if (parameters)\n this.setParameters(parameters);\n return this;\n }\n\n /**\n * Adds new AND WHERE condition in the query builder.\n * Additionally you can add parameters used in where expression.\n */\n andWhere(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres.push({ type: \"and\", condition: this.getWhereCondition(where) });\n if (parameters) this.setParameters(parameters);\n return this;\n }\n\n /**\n * Adds new OR WHERE condition in the query builder.\n * Additionally you can add parameters used in where expression.\n */\n orWhere(where: Brackets|string|((qb: this) => string)|ObjectLiteral|ObjectLiteral[], parameters?: ObjectLiteral): this {\n this.expressionMap.wheres.push({ type: \"or\", condition: this.getWhereCondition(where) });\n if (parameters) this.setParameters(parameters);\n return this;\n }\n\n /**\n * Sets WHERE condition in the query builder with a condition for the given ids.\n * If you had previously WHERE expression defined,\n * calling this function will override previously set WHERE conditions.\n */\n whereInIds(ids: any|any[]): this {\n return this.where(this.getWhereInIdsCondition(ids));\n }\n\n /**\n * Adds new AND WHERE with conditions for the given ids.\n */\n andWhereInIds(ids: any|any[]): this {\n return this.andWhere(this.getWhereInIdsCondition(ids));\n }\n\n /**\n * Adds new OR WHERE with conditions for the given ids.\n */\n orWhereInIds(ids: any|any[]): this {\n return this.orWhere(this.getWhereInIdsCondition(ids));\n }\n /**\n * Optional returning/output clause.\n * This will return given column values.\n */\n output(columns: string[]): this;\n\n /**\n * Optional returning/output clause.\n * Returning is a SQL string containing returning statement.\n */\n output(output: string): this;\n\n /**\n * Optional returning/output clause.\n */\n output(output: string|string[]): this;\n\n /**\n * Optional returning/output clause.\n */\n output(output: string|string[]): this {\n return this.returning(output);\n }\n\n /**\n * Optional returning/output clause.\n * This will return given column values.\n */\n returning(columns: string[]): this;\n\n /**\n * Optional returning/output clause.\n * Returning is a SQL string containing returning statement.\n */\n returning(returning: string): this;\n\n /**\n * Optional returning/output clause.\n */\n returning(returning: string|string[]): this;\n\n /**\n * Optional returning/output clause.\n */\n returning(returning: string|string[]): this {\n\n // not all databases support returning/output cause\n if (!this.connection.driver.isReturningSqlSupported())\n throw new ReturningStatementNotSupportedError();\n\n this.expressionMap.returning = returning;\n return this;\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates DELETE express used to perform query.\n */\n protected createDeleteExpression() {\n const tableName = this.getTableName(this.getMainTableName());\n const whereExpression = this.createWhereExpression();\n const returningExpression = this.createReturningExpression();\n\n if (returningExpression && (this.connection.driver instanceof PostgresDriver || this.connection.driver instanceof CockroachDriver)) {\n return `DELETE FROM ${tableName}${whereExpression} RETURNING ${returningExpression}`;\n\n } else if (returningExpression !== \"\" && this.connection.driver instanceof SqlServerDriver) {\n return `DELETE FROM ${tableName} OUTPUT ${returningExpression}${whereExpression}`;\n\n } else {\n return `DELETE FROM ${tableName}${whereExpression}`;\n }\n }\n\n}\n"],"sourceRoot":".."}
@@ -42,7 +42,9 @@ export declare class UpdateQueryBuilder<Entity> extends QueryBuilder<Entity> imp
42
42
  */
43
43
  orWhere(where: string | ((qb: this) => string) | Brackets | ObjectLiteral | ObjectLiteral[], parameters?: ObjectLiteral): this;
44
44
  /**
45
- * Adds new AND WHERE with conditions for the given ids.
45
+ * Sets WHERE condition in the query builder with a condition for the given ids.
46
+ * If you had previously WHERE expression defined,
47
+ * calling this function will override previously set WHERE conditions.
46
48
  */
47
49
  whereInIds(ids: any | any[]): this;
48
50
  /**
@@ -195,7 +195,9 @@ var UpdateQueryBuilder = /** @class */ (function (_super) {
195
195
  return this;
196
196
  };
197
197
  /**
198
- * Adds new AND WHERE with conditions for the given ids.
198
+ * Sets WHERE condition in the query builder with a condition for the given ids.
199
+ * If you had previously WHERE expression defined,
200
+ * calling this function will override previously set WHERE conditions.
199
201
  */
200
202
  UpdateQueryBuilder.prototype.whereInIds = function (ids) {
201
203
  return this.where(this.getWhereInIdsCondition(ids));