typeorm 0.3.18-dev.e72a9da → 0.3.18-dev.ebd61d1

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 (100) hide show
  1. package/browser/driver/DriverUtils.js +2 -5
  2. package/browser/driver/DriverUtils.js.map +1 -1
  3. package/browser/driver/sap/SapDriver.js +1 -1
  4. package/browser/driver/sap/SapDriver.js.map +1 -1
  5. package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
  6. package/browser/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
  7. package/browser/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  8. package/browser/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  9. package/browser/driver/sqlserver/SqlServerQueryRunner.js +13 -0
  10. package/browser/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  11. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
  12. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +3 -0
  13. package/browser/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
  14. package/browser/entity-manager/EntityManager.js +5 -1
  15. package/browser/entity-manager/EntityManager.js.map +1 -1
  16. package/browser/entity-manager/MongoEntityManager.d.ts +5 -1
  17. package/browser/entity-manager/MongoEntityManager.js +7 -0
  18. package/browser/entity-manager/MongoEntityManager.js.map +1 -1
  19. package/browser/error/QueryFailedError.d.ts +3 -3
  20. package/browser/error/QueryFailedError.js.map +1 -1
  21. package/browser/find-options/FindOptionsUtils.js +1 -1
  22. package/browser/find-options/FindOptionsUtils.js.map +1 -1
  23. package/browser/index.d.ts +1 -0
  24. package/browser/index.js +1 -0
  25. package/browser/index.js.map +1 -1
  26. package/browser/naming-strategy/DefaultNamingStrategy.d.ts +0 -1
  27. package/browser/naming-strategy/DefaultNamingStrategy.js +0 -3
  28. package/browser/naming-strategy/DefaultNamingStrategy.js.map +1 -1
  29. package/browser/naming-strategy/NamingStrategyInterface.d.ts +0 -4
  30. package/browser/naming-strategy/NamingStrategyInterface.js.map +1 -1
  31. package/browser/persistence/Subject.js +2 -1
  32. package/browser/persistence/Subject.js.map +1 -1
  33. package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js +6 -2
  34. package/browser/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
  35. package/browser/query-builder/QueryBuilder.js +1 -1
  36. package/browser/query-builder/QueryBuilder.js.map +1 -1
  37. package/browser/repository/MongoRepository.d.ts +5 -1
  38. package/browser/repository/MongoRepository.js +6 -0
  39. package/browser/repository/MongoRepository.js.map +1 -1
  40. package/browser/repository/Repository.d.ts +1 -1
  41. package/browser/repository/Repository.js +9 -5
  42. package/browser/repository/Repository.js.map +1 -1
  43. package/commands/CommandUtils.js +6 -1
  44. package/commands/CommandUtils.js.map +1 -1
  45. package/commands/EntityCreateCommand.d.ts +3 -0
  46. package/commands/EntityCreateCommand.js +7 -0
  47. package/commands/EntityCreateCommand.js.map +1 -1
  48. package/commands/MigrationCreateCommand.d.ts +5 -1
  49. package/commands/MigrationCreateCommand.js +6 -1
  50. package/commands/MigrationCreateCommand.js.map +1 -1
  51. package/commands/MigrationGenerateCommand.d.ts +5 -1
  52. package/commands/MigrationGenerateCommand.js +5 -0
  53. package/commands/MigrationGenerateCommand.js.map +1 -1
  54. package/commands/SubscriberCreateCommand.d.ts +3 -0
  55. package/commands/SubscriberCreateCommand.js +7 -0
  56. package/commands/SubscriberCreateCommand.js.map +1 -1
  57. package/driver/DriverUtils.js +2 -5
  58. package/driver/DriverUtils.js.map +1 -1
  59. package/driver/sap/SapDriver.js +2 -2
  60. package/driver/sap/SapDriver.js.map +1 -1
  61. package/driver/sqlserver/SqlServerConnectionCredentialsOptions.d.ts +2 -1
  62. package/driver/sqlserver/SqlServerConnectionCredentialsOptions.js.map +1 -1
  63. package/driver/sqlserver/SqlServerConnectionOptions.d.ts +5 -0
  64. package/driver/sqlserver/SqlServerConnectionOptions.js.map +1 -1
  65. package/driver/sqlserver/SqlServerQueryRunner.js +13 -0
  66. package/driver/sqlserver/SqlServerQueryRunner.js.map +1 -1
  67. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.d.ts +12 -0
  68. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js +4 -0
  69. package/driver/sqlserver/authentication/AzureActiveDirectoryDefaultAuthentication.js.map +1 -0
  70. package/entity-manager/EntityManager.js +5 -1
  71. package/entity-manager/EntityManager.js.map +1 -1
  72. package/entity-manager/MongoEntityManager.d.ts +5 -1
  73. package/entity-manager/MongoEntityManager.js +7 -0
  74. package/entity-manager/MongoEntityManager.js.map +1 -1
  75. package/error/QueryFailedError.d.ts +3 -3
  76. package/error/QueryFailedError.js.map +1 -1
  77. package/find-options/FindOptionsUtils.js +1 -1
  78. package/find-options/FindOptionsUtils.js.map +1 -1
  79. package/index.d.ts +1 -0
  80. package/index.js +1 -0
  81. package/index.js.map +1 -1
  82. package/index.mjs +2 -0
  83. package/naming-strategy/DefaultNamingStrategy.d.ts +0 -1
  84. package/naming-strategy/DefaultNamingStrategy.js +0 -3
  85. package/naming-strategy/DefaultNamingStrategy.js.map +1 -1
  86. package/naming-strategy/NamingStrategyInterface.d.ts +0 -4
  87. package/naming-strategy/NamingStrategyInterface.js.map +1 -1
  88. package/package.json +1 -1
  89. package/persistence/Subject.js +2 -1
  90. package/persistence/Subject.js.map +1 -1
  91. package/persistence/subject-builder/ManyToManySubjectBuilder.js +6 -2
  92. package/persistence/subject-builder/ManyToManySubjectBuilder.js.map +1 -1
  93. package/query-builder/QueryBuilder.js +1 -1
  94. package/query-builder/QueryBuilder.js.map +1 -1
  95. package/repository/MongoRepository.d.ts +5 -1
  96. package/repository/MongoRepository.js +6 -0
  97. package/repository/MongoRepository.js.map +1 -1
  98. package/repository/Repository.d.ts +1 -1
  99. package/repository/Repository.js +9 -5
  100. package/repository/Repository.js.map +1 -1
@@ -90,11 +90,8 @@ export class DriverUtils {
90
90
  * @return An alias that is no longer than the divers max alias length.
91
91
  */
92
92
  static buildAlias({ maxAliasLength }, buildOptions, ...alias) {
93
- const newAlias = alias.length === 1
94
- ? alias[0]
95
- : alias.join(buildOptions && buildOptions.joiner
96
- ? buildOptions.joiner
97
- : "_");
93
+ const joiner = buildOptions && buildOptions.joiner ? buildOptions.joiner : "_";
94
+ let newAlias = alias.length === 1 ? alias[0] : alias.join(joiner);
98
95
  if (maxAliasLength &&
99
96
  maxAliasLength > 0 &&
100
97
  newAlias.length > maxAliasLength) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/DriverUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAc;QAChC,OAAO;YACH,QAAQ;YACR,SAAS;YACT,cAAc;YACd,cAAc;YACd,OAAO;YACP,MAAM;YACN,gBAAgB;YAChB,WAAW;SACd,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IACnC,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAc;QAC/B,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,CAAC,yBAAyB,CAAC,MAAc,EAAE,OAAe;QAC5D,OAAO,CACH,MAAM,CAAC,OAAO,IAAI,IAAI;YACtB,YAAY,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CACzD,CAAA;IACL,CAAC;IAED,MAAM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;SACnC,CAAA;QAED,uDAAuD;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YACtD,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SAC7B;QAED,OAAO,aAAa,CAAA;IACxB,CAAC;CACJ","file":"DriverUtils.js","sourcesContent":["import { Driver } from \"./Driver\"\nimport { hash, shorten } from \"../util/StringUtils\"\nimport { VersionUtils } from \"../util/VersionUtils\"\n\n/**\n * Common driver utility functions.\n */\nexport class DriverUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns true if given driver is SQLite-based driver.\n */\n static isSQLiteFamily(driver: Driver): boolean {\n return [\n \"sqlite\",\n \"cordova\",\n \"react-native\",\n \"nativescript\",\n \"sqljs\",\n \"expo\",\n \"better-sqlite3\",\n \"capacitor\",\n ].includes(driver.options.type)\n }\n\n /**\n * Returns true if given driver is MySQL-based driver.\n */\n static isMySQLFamily(driver: Driver): boolean {\n return [\"mysql\", \"mariadb\"].includes(driver.options.type)\n }\n\n static isReleaseVersionOrGreater(driver: Driver, version: string): boolean {\n return (\n driver.version != null &&\n VersionUtils.isGreaterOrEqual(driver.version, version)\n )\n }\n\n static isPostgresFamily(driver: Driver): boolean {\n return [\"postgres\", \"aurora-postgres\", \"cockroachdb\"].includes(\n driver.options.type,\n )\n }\n\n /**\n * Normalizes and builds a new driver options.\n * Extracts settings from connection url and sets to a new options object.\n */\n static buildDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseConnectionUrl(options.url) as {\n [key: string]: any\n }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * buildDriverOptions for MongodDB only to support replica set\n */\n static buildMongoDBDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseMongoDBConnectionUrl(\n options.url,\n ) as { [key: string]: any }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * Joins and shortens alias if needed.\n *\n * If the alias length is greater than the limit allowed by the current\n * driver, replaces it with a shortend string, if the shortend string\n * is still too long, it will then hash the alias.\n *\n * @param driver Current `Driver`.\n * @param buildOptions Optional settings.\n * @param alias Alias parts.\n *\n * @return An alias that is no longer than the divers max alias length.\n */\n static buildAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | undefined,\n ...alias: string[]\n ): string {\n const newAlias =\n alias.length === 1\n ? alias[0]\n : alias.join(\n buildOptions && buildOptions.joiner\n ? buildOptions.joiner\n : \"_\",\n )\n if (\n maxAliasLength &&\n maxAliasLength > 0 &&\n newAlias.length > maxAliasLength\n ) {\n if (buildOptions && buildOptions.shorten === true) {\n const shortenedAlias = shorten(newAlias)\n if (shortenedAlias.length < maxAliasLength) {\n return shortenedAlias\n }\n }\n\n return hash(newAlias, { length: maxAliasLength })\n }\n\n return newAlias\n }\n\n /**\n * @deprecated use `buildAlias` instead.\n */\n static buildColumnAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ) {\n if (typeof buildOptions === \"string\") {\n alias.unshift(buildOptions)\n buildOptions = { shorten: false, joiner: \"_\" }\n } else {\n buildOptions = Object.assign(\n { shorten: false, joiner: \"_\" },\n buildOptions,\n )\n }\n return this.buildAlias(\n { maxAliasLength } as Driver,\n buildOptions,\n ...alias,\n )\n }\n\n // -------------------------------------------------------------------------\n // Private Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Extracts connection data from the connection url.\n */\n private static parseConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n // remove mongodb query params\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n const [host, port] = hostAndPort.split(\":\")\n\n return {\n type: type,\n host: host,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n }\n\n /**\n * Extracts connection data from the connection url for MongoDB to support replica set.\n */\n private static parseMongoDBConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n let afterQuestionMark = \"\"\n let host = undefined\n let port = undefined\n let hostReplicaSet = undefined\n let replicaSet = undefined\n\n let optionsObject: any = {}\n\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n // split params\n afterQuestionMark = afterBase.substr(\n afterBase.indexOf(\"?\") + 1,\n afterBase.length,\n )\n\n const optionsList = afterQuestionMark.split(\"&\")\n let optionKey: string\n let optionValue: string\n\n // create optionsObject for merge with connectionUrl object before return\n optionsList.forEach((optionItem) => {\n optionKey = optionItem.split(\"=\")[0]\n optionValue = optionItem.split(\"=\")[1]\n optionsObject[optionKey] = optionValue\n })\n\n // specific replicaSet value to set options about hostReplicaSet\n replicaSet = optionsObject[\"replicaSet\"]\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n\n // If replicaSet have value set It as hostlist, If not set like standalone host\n if (replicaSet) {\n hostReplicaSet = hostAndPort\n } else {\n ;[host, port] = hostAndPort.split(\":\")\n }\n\n let connectionUrl: any = {\n type: type,\n host: host,\n hostReplicaSet: hostReplicaSet,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n\n // Loop to set every options in connectionUrl to object\n for (const [key, value] of Object.entries(optionsObject)) {\n connectionUrl[key] = value\n }\n\n return connectionUrl\n }\n}\n"],"sourceRoot":".."}
1
+ {"version":3,"sources":["../browser/src/driver/DriverUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEnD;;GAEG;AACH,MAAM,OAAO,WAAW;IACpB,4EAA4E;IAC5E,wBAAwB;IACxB,4EAA4E;IAE5E;;OAEG;IACH,MAA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CAAC,EAAE,UAAU,CAAC,CAAA;YACpD,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,UAAU,GAAG,CAAC,CAAC,CAAA;SACxD;QAED,+EAA+E;QAC/E,IAAI,UAAU,EAAE;YACZ,cAAc,GAAG,WAAW,CAAA;SAC/B;aAAM;YACH,CAAC;YAAA,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;SACzC;QAED,IAAI,aAAa,GAAQ;YACrB,IAAI,EAAE,IAAI;YACV,IAAI,EAAE,IAAI;YACV,cAAc,EAAE,cAAc;YAC9B,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;YACtC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;YACtC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;YACvC,QAAQ,EAAE,SAAS,IAAI,SAAS;SACnC,CAAA;QAED,uDAAuD;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;YACtD,aAAa,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SAC7B;QAED,OAAO,aAAa,CAAA;IACxB,CAAC;CACJ","file":"DriverUtils.js","sourcesContent":["import { Driver } from \"./Driver\"\nimport { hash, shorten } from \"../util/StringUtils\"\nimport { VersionUtils } from \"../util/VersionUtils\"\n\n/**\n * Common driver utility functions.\n */\nexport class DriverUtils {\n // -------------------------------------------------------------------------\n // Public Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Returns true if given driver is SQLite-based driver.\n */\n static isSQLiteFamily(driver: Driver): boolean {\n return [\n \"sqlite\",\n \"cordova\",\n \"react-native\",\n \"nativescript\",\n \"sqljs\",\n \"expo\",\n \"better-sqlite3\",\n \"capacitor\",\n ].includes(driver.options.type)\n }\n\n /**\n * Returns true if given driver is MySQL-based driver.\n */\n static isMySQLFamily(driver: Driver): boolean {\n return [\"mysql\", \"mariadb\"].includes(driver.options.type)\n }\n\n static isReleaseVersionOrGreater(driver: Driver, version: string): boolean {\n return (\n driver.version != null &&\n VersionUtils.isGreaterOrEqual(driver.version, version)\n )\n }\n\n static isPostgresFamily(driver: Driver): boolean {\n return [\"postgres\", \"aurora-postgres\", \"cockroachdb\"].includes(\n driver.options.type,\n )\n }\n\n /**\n * Normalizes and builds a new driver options.\n * Extracts settings from connection url and sets to a new options object.\n */\n static buildDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseConnectionUrl(options.url) as {\n [key: string]: any\n }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * buildDriverOptions for MongodDB only to support replica set\n */\n static buildMongoDBDriverOptions(\n options: any,\n buildOptions?: { useSid: boolean },\n ): any {\n if (options.url) {\n const urlDriverOptions = this.parseMongoDBConnectionUrl(\n options.url,\n ) as { [key: string]: any }\n\n if (\n buildOptions &&\n buildOptions.useSid &&\n urlDriverOptions.database\n ) {\n urlDriverOptions.sid = urlDriverOptions.database\n }\n\n for (const key of Object.keys(urlDriverOptions)) {\n if (typeof urlDriverOptions[key] === \"undefined\") {\n delete urlDriverOptions[key]\n }\n }\n\n return Object.assign({}, options, urlDriverOptions)\n }\n return Object.assign({}, options)\n }\n\n /**\n * Joins and shortens alias if needed.\n *\n * If the alias length is greater than the limit allowed by the current\n * driver, replaces it with a shortend string, if the shortend string\n * is still too long, it will then hash the alias.\n *\n * @param driver Current `Driver`.\n * @param buildOptions Optional settings.\n * @param alias Alias parts.\n *\n * @return An alias that is no longer than the divers max alias length.\n */\n static buildAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | undefined,\n ...alias: string[]\n ): string {\n const joiner =\n buildOptions && buildOptions.joiner ? buildOptions.joiner : \"_\"\n\n let newAlias = alias.length === 1 ? alias[0] : alias.join(joiner)\n\n if (\n maxAliasLength &&\n maxAliasLength > 0 &&\n newAlias.length > maxAliasLength\n ) {\n if (buildOptions && buildOptions.shorten === true) {\n const shortenedAlias = shorten(newAlias)\n if (shortenedAlias.length < maxAliasLength) {\n return shortenedAlias\n }\n }\n\n return hash(newAlias, { length: maxAliasLength })\n }\n\n return newAlias\n }\n\n /**\n * @deprecated use `buildAlias` instead.\n */\n static buildColumnAlias(\n { maxAliasLength }: Driver,\n buildOptions: { shorten?: boolean; joiner?: string } | string,\n ...alias: string[]\n ) {\n if (typeof buildOptions === \"string\") {\n alias.unshift(buildOptions)\n buildOptions = { shorten: false, joiner: \"_\" }\n } else {\n buildOptions = Object.assign(\n { shorten: false, joiner: \"_\" },\n buildOptions,\n )\n }\n return this.buildAlias(\n { maxAliasLength } as Driver,\n buildOptions,\n ...alias,\n )\n }\n\n // -------------------------------------------------------------------------\n // Private Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Extracts connection data from the connection url.\n */\n private static parseConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n // remove mongodb query params\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n const [host, port] = hostAndPort.split(\":\")\n\n return {\n type: type,\n host: host,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n }\n\n /**\n * Extracts connection data from the connection url for MongoDB to support replica set.\n */\n private static parseMongoDBConnectionUrl(url: string) {\n const type = url.split(\":\")[0]\n const firstSlashes = url.indexOf(\"//\")\n const preBase = url.substr(firstSlashes + 2)\n const secondSlash = preBase.indexOf(\"/\")\n const base =\n secondSlash !== -1 ? preBase.substr(0, secondSlash) : preBase\n let afterBase =\n secondSlash !== -1 ? preBase.substr(secondSlash + 1) : undefined\n let afterQuestionMark = \"\"\n let host = undefined\n let port = undefined\n let hostReplicaSet = undefined\n let replicaSet = undefined\n\n let optionsObject: any = {}\n\n if (afterBase && afterBase.indexOf(\"?\") !== -1) {\n // split params\n afterQuestionMark = afterBase.substr(\n afterBase.indexOf(\"?\") + 1,\n afterBase.length,\n )\n\n const optionsList = afterQuestionMark.split(\"&\")\n let optionKey: string\n let optionValue: string\n\n // create optionsObject for merge with connectionUrl object before return\n optionsList.forEach((optionItem) => {\n optionKey = optionItem.split(\"=\")[0]\n optionValue = optionItem.split(\"=\")[1]\n optionsObject[optionKey] = optionValue\n })\n\n // specific replicaSet value to set options about hostReplicaSet\n replicaSet = optionsObject[\"replicaSet\"]\n afterBase = afterBase.substr(0, afterBase.indexOf(\"?\"))\n }\n\n const lastAtSign = base.lastIndexOf(\"@\")\n const usernameAndPassword = base.substr(0, lastAtSign)\n const hostAndPort = base.substr(lastAtSign + 1)\n\n let username = usernameAndPassword\n let password = \"\"\n const firstColon = usernameAndPassword.indexOf(\":\")\n if (firstColon !== -1) {\n username = usernameAndPassword.substr(0, firstColon)\n password = usernameAndPassword.substr(firstColon + 1)\n }\n\n // If replicaSet have value set It as hostlist, If not set like standalone host\n if (replicaSet) {\n hostReplicaSet = hostAndPort\n } else {\n ;[host, port] = hostAndPort.split(\":\")\n }\n\n let connectionUrl: any = {\n type: type,\n host: host,\n hostReplicaSet: hostReplicaSet,\n username: decodeURIComponent(username),\n password: decodeURIComponent(password),\n port: port ? parseInt(port) : undefined,\n database: afterBase || undefined,\n }\n\n // Loop to set every options in connectionUrl to object\n for (const [key, value] of Object.entries(optionsObject)) {\n connectionUrl[key] = value\n }\n\n return connectionUrl\n }\n}\n"],"sourceRoot":".."}
@@ -1,5 +1,5 @@
1
- import { TypeORMError, } from "../..";
2
1
  import { DriverPackageNotInstalledError } from "../../error/DriverPackageNotInstalledError";
2
+ import { TypeORMError } from "../../error/TypeORMError";
3
3
  import { PlatformTools } from "../../platform/PlatformTools";
4
4
  import { RdbmsSchemaBuilder } from "../../schema-builder/RdbmsSchemaBuilder";
5
5
  import { ApplyValueTransformers } from "../../util/ApplyValueTransformers";
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/sap/SapDriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAQH,YAAY,GACf,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAE3F,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAM9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5D;;;;GAIG;AACH,MAAM,OAAO,SAAS;IA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;oBAChB,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC;gBAC1C,CAAC,cAAc,CAAC,kBAAkB,KAAK,MAAM;oBACzC,WAAW,CAAC,WAAW,KAAK,cAAc,CAAC,WAAW,CAAC,CAC9D,CAAA;QACL,CAAC,CAAC,CAAA;IACN,CAAC;IAED;;OAEG;IACH,uBAAuB;QACnB,OAAO,KAAK,CAAA;IAChB,CAAC;IAED;;OAEG;IACH,yBAAyB;QACrB,OAAO,KAAK,CAAA;IAChB,CAAC;IAED;;OAEG;IACH,6BAA6B;QACzB,OAAO,IAAI,CAAA;IACf,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,aAAqB,EAAE,KAAa;QAChD,OAAO,GAAG,CAAA;IACd,CAAC;IAED,4EAA4E;IAC5E,oBAAoB;IACpB,4EAA4E;IAE5E;;OAEG;IACO,gBAAgB;QACtB,IAAI;YACA,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;YACpE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;SACvB;QAAC,OAAO,CAAC,EAAE;YACR,qCAAqC;YACrC,MAAM,IAAI,8BAA8B,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;SACnE;QAED,IAAI;YACA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gBAChC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;aACzC;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,qCAAqC;YACrC,MAAM,IAAI,8BAA8B,CACpC,UAAU,EACV,kBAAkB,CACrB,CAAA;SACJ;IACL,CAAC;CACJ","file":"SapDriver.js","sourcesContent":["import {\n ColumnType,\n DataSource,\n EntityMetadata,\n ObjectLiteral,\n Table,\n TableColumn,\n TableForeignKey,\n TypeORMError,\n} from \"../..\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { Driver } from \"../Driver\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { SapConnectionOptions } from \"./SapConnectionOptions\"\nimport { SapQueryRunner } from \"./SapQueryRunner\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with SAP Hana DBMS.\n *\n * todo: looks like there is no built in support for connection pooling, we need to figure out something\n */\nexport class SapDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Hana Pool instance.\n */\n client: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: SapConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"simple\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a1569875191014b507cf392724b7eb.html\n */\n supportedDataTypes: ColumnType[] = [\n \"tinyint\",\n \"smallint\",\n \"int\",\n \"integer\",\n \"bigint\",\n \"smalldecimal\",\n \"decimal\",\n \"dec\",\n \"real\",\n \"double\",\n \"float\",\n \"date\",\n \"time\",\n \"seconddate\",\n \"timestamp\",\n \"boolean\",\n \"char\",\n \"nchar\",\n \"varchar\",\n \"nvarchar\",\n \"text\",\n \"alphanum\",\n \"shorttext\",\n \"array\",\n \"varbinary\",\n \"blob\",\n \"clob\",\n \"nclob\",\n \"st_geometry\",\n \"st_point\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[] = []\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\"st_geometry\", \"st_point\"]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"varchar\",\n \"nvarchar\",\n \"alphanum\",\n \"shorttext\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\"decimal\"]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"decimal\"]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"timestamp\",\n createDateDefault: \"CURRENT_TIMESTAMP\",\n updateDate: \"timestamp\",\n updateDateDefault: \"CURRENT_TIMESTAMP\",\n deleteDate: \"timestamp\",\n deleteDateNullable: true,\n version: \"integer\",\n treeLevel: \"integer\",\n migrationId: \"integer\",\n migrationName: \"nvarchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"integer\",\n cacheIdentifier: \"nvarchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"integer\",\n cacheQuery: \"nvarchar(5000)\" as any,\n cacheResult: \"text\",\n metadataType: \"nvarchar\",\n metadataDatabase: \"nvarchar\",\n metadataSchema: \"nvarchar\",\n metadataTable: \"nvarchar\",\n metadataName: \"nvarchar\",\n metadataValue: \"nvarchar(5000)\" as any,\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n char: { length: 1 },\n nchar: { length: 1 },\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n shorttext: { length: 255 },\n varbinary: { length: 255 },\n decimal: { precision: 18, scale: 0 },\n }\n\n /**\n * Max length allowed by SAP HANA for aliases (identifiers).\n * @see https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a760537519101497e3cfe07b348f3c.html\n */\n maxAliasLength = 128\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n }\n\n dummyTableName = `SYS.DUMMY`\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as SapConnectionOptions\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n // HANA connection info\n const dbParams = {\n hostName: this.options.host,\n port: this.options.port,\n userName: this.options.username,\n password: this.options.password,\n ...this.options.extra,\n }\n\n if (this.options.database) dbParams.databaseName = this.options.database\n if (this.options.encrypt) dbParams.encrypt = this.options.encrypt\n if (this.options.sslValidateCertificate)\n dbParams.validateCertificate = this.options.sslValidateCertificate\n if (this.options.key) dbParams.key = this.options.key\n if (this.options.cert) dbParams.cert = this.options.cert\n if (this.options.ca) dbParams.ca = this.options.ca\n\n // pool options\n const options: any = {\n min:\n this.options.pool && this.options.pool.min\n ? this.options.pool.min\n : 1,\n max:\n this.options.pool && this.options.pool.max\n ? this.options.pool.max\n : 10,\n }\n\n if (this.options.pool && this.options.pool.checkInterval)\n options.checkInterval = this.options.pool.checkInterval\n if (this.options.pool && this.options.pool.maxWaitingRequests)\n options.maxWaitingRequests = this.options.pool.maxWaitingRequests\n if (this.options.pool && this.options.pool.requestTimeout)\n options.requestTimeout = this.options.pool.requestTimeout\n if (this.options.pool && this.options.pool.idleTimeout)\n options.idleTimeout = this.options.pool.idleTimeout\n\n const { logger } = this.connection\n\n const poolErrorHandler =\n options.poolErrorHandler ||\n ((error: any) =>\n logger.log(\"warn\", `SAP Hana pool raised an error. ${error}`))\n this.client.eventEmitter.on(\"poolError\", poolErrorHandler)\n\n // create the pool\n this.master = this.client.createPool(dbParams, options)\n\n if (!this.database || !this.schema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.schema) {\n this.schema = await queryRunner.getCurrentSchema()\n }\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n const promise = this.master.clear()\n this.master = undefined\n return promise\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new SapQueryRunner(this, mode)\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => {\n if (nativeParameters[key] instanceof Date)\n return DateUtils.mixedDateToDatetimeString(\n nativeParameters[key],\n true,\n )\n\n return nativeParameters[key]\n },\n )\n\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n if (value instanceof Date) {\n return DateUtils.mixedDateToDatetimeString(value, true)\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return `\"${columnName}\"`\n }\n\n /**\n * Build full table name with schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = this.schema\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database: driverDatabase,\n schema: (parts.length > 1 ? parts[0] : undefined) || driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDatetimeString(value, true)\n } else if (columnMetadata.type === \"seconddate\") {\n return DateUtils.mixedDateToDatetimeString(value, false)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (columnMetadata.type === \"simple-enum\") {\n return DateUtils.simpleEnumToString(value)\n } else if (columnMetadata.isArray) {\n return () => `ARRAY(${value.map((it: any) => `'${it}'`)})`\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (columnMetadata.type === Boolean) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"seconddate\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (columnMetadata.type === \"simple-enum\") {\n value = DateUtils.stringToSimpleEnum(value, columnMetadata)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : value\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"int\") {\n return \"integer\"\n } else if (column.type === String) {\n return \"nvarchar\"\n } else if (column.type === Date) {\n return \"timestamp\"\n } else if (column.type === Boolean) {\n return \"boolean\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === \"uuid\") {\n return \"nvarchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"nvarchar\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"true\" : \"false\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === null || defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case \"varchar\":\n case \"nvarchar\":\n case \"shorttext\":\n case String:\n return \"255\"\n case \"alphanum\":\n return \"127\"\n case \"varbinary\":\n return \"255\"\n }\n\n return \"\"\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because SqlServer sets `varchar` and `nvarchar` length to 1 by default.\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n if (!this.master) {\n throw new TypeORMError(\"Driver not Connected\")\n }\n\n return this.master.getConnection()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return this.obtainMasterConnection()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult\n ) {\n value = insertResult\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, _this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, _this.getColumnLength(columnMetadata));\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, _this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n const normalizeDefault = this.normalizeDefault(columnMetadata)\n const hanaNullComapatibleDefault =\n normalizeDefault == null ? undefined : normalizeDefault\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n (columnMetadata.length &&\n tableColumn.length !==\n this.getColumnLength(columnMetadata)) ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n // || tableColumn.comment !== columnMetadata.comment || // todo\n (!tableColumn.isGenerated &&\n hanaNullComapatibleDefault !== tableColumn.default) || // we included check for generated here, because generated columns already can have default values\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * If driver dependency is not given explicitly, then try to load it via \"require\".\n */\n protected loadDependencies(): void {\n try {\n const client = this.options.driver || PlatformTools.load(\"hdb-pool\")\n this.client = client\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\"SAP Hana\", \"hdb-pool\")\n }\n\n try {\n if (!this.options.hanaClientDriver) {\n PlatformTools.load(\"@sap/hana-client\")\n }\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\n \"SAP Hana\",\n \"@sap/hana-client\",\n )\n }\n }\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/sap/SapDriver.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4CAA4C,CAAA;AAC3F,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,kBAAkB,E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,gBAAgB,EAAE;gBAChC,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;aACzC;SACJ;QAAC,OAAO,CAAC,EAAE;YACR,qCAAqC;YACrC,MAAM,IAAI,8BAA8B,CACpC,UAAU,EACV,kBAAkB,CACrB,CAAA;SACJ;IACL,CAAC;CACJ","file":"SapDriver.js","sourcesContent":["import {\n ColumnType,\n DataSource,\n EntityMetadata,\n ObjectLiteral,\n Table,\n TableColumn,\n TableForeignKey,\n} from \"../..\"\nimport { DriverPackageNotInstalledError } from \"../../error/DriverPackageNotInstalledError\"\nimport { TypeORMError } from \"../../error/TypeORMError\"\nimport { ColumnMetadata } from \"../../metadata/ColumnMetadata\"\nimport { PlatformTools } from \"../../platform/PlatformTools\"\nimport { RdbmsSchemaBuilder } from \"../../schema-builder/RdbmsSchemaBuilder\"\nimport { ApplyValueTransformers } from \"../../util/ApplyValueTransformers\"\nimport { DateUtils } from \"../../util/DateUtils\"\nimport { OrmUtils } from \"../../util/OrmUtils\"\nimport { Driver } from \"../Driver\"\nimport { CteCapabilities } from \"../types/CteCapabilities\"\nimport { DataTypeDefaults } from \"../types/DataTypeDefaults\"\nimport { MappedColumnTypes } from \"../types/MappedColumnTypes\"\nimport { SapConnectionOptions } from \"./SapConnectionOptions\"\nimport { SapQueryRunner } from \"./SapQueryRunner\"\nimport { ReplicationMode } from \"../types/ReplicationMode\"\nimport { DriverUtils } from \"../DriverUtils\"\nimport { View } from \"../../schema-builder/view/View\"\nimport { InstanceChecker } from \"../../util/InstanceChecker\"\nimport { UpsertType } from \"../types/UpsertType\"\n\n/**\n * Organizes communication with SAP Hana DBMS.\n *\n * todo: looks like there is no built in support for connection pooling, we need to figure out something\n */\nexport class SapDriver implements Driver {\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection used by driver.\n */\n connection: DataSource\n\n /**\n * Hana Pool instance.\n */\n client: any\n\n /**\n * Pool for master database.\n */\n master: any\n\n /**\n * Pool for slave databases.\n * Used in replication.\n */\n slaves: any[] = []\n\n // -------------------------------------------------------------------------\n // Public Implemented Properties\n // -------------------------------------------------------------------------\n\n /**\n * Connection options.\n */\n options: SapConnectionOptions\n\n /**\n * Database name used to perform all write queries.\n */\n database?: string\n\n /**\n * Schema name used to perform all write queries.\n */\n schema?: string\n\n /**\n * Indicates if replication is enabled.\n */\n isReplicated: boolean = false\n\n /**\n * Indicates if tree tables are supported by this driver.\n */\n treeSupport = true\n\n /**\n * Represent transaction support by this driver\n */\n transactionSupport = \"simple\" as const\n\n /**\n * Gets list of supported column data types by a driver.\n *\n * @see https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a1569875191014b507cf392724b7eb.html\n */\n supportedDataTypes: ColumnType[] = [\n \"tinyint\",\n \"smallint\",\n \"int\",\n \"integer\",\n \"bigint\",\n \"smalldecimal\",\n \"decimal\",\n \"dec\",\n \"real\",\n \"double\",\n \"float\",\n \"date\",\n \"time\",\n \"seconddate\",\n \"timestamp\",\n \"boolean\",\n \"char\",\n \"nchar\",\n \"varchar\",\n \"nvarchar\",\n \"text\",\n \"alphanum\",\n \"shorttext\",\n \"array\",\n \"varbinary\",\n \"blob\",\n \"clob\",\n \"nclob\",\n \"st_geometry\",\n \"st_point\",\n ]\n\n /**\n * Returns type of upsert supported by driver if any\n */\n supportedUpsertTypes: UpsertType[] = []\n\n /**\n * Gets list of spatial column data types.\n */\n spatialTypes: ColumnType[] = [\"st_geometry\", \"st_point\"]\n\n /**\n * Gets list of column data types that support length by a driver.\n */\n withLengthColumnTypes: ColumnType[] = [\n \"varchar\",\n \"nvarchar\",\n \"alphanum\",\n \"shorttext\",\n \"varbinary\",\n ]\n\n /**\n * Gets list of column data types that support precision by a driver.\n */\n withPrecisionColumnTypes: ColumnType[] = [\"decimal\"]\n\n /**\n * Gets list of column data types that support scale by a driver.\n */\n withScaleColumnTypes: ColumnType[] = [\"decimal\"]\n\n /**\n * Orm has special columns and we need to know what database column types should be for those types.\n * Column types are driver dependant.\n */\n mappedDataTypes: MappedColumnTypes = {\n createDate: \"timestamp\",\n createDateDefault: \"CURRENT_TIMESTAMP\",\n updateDate: \"timestamp\",\n updateDateDefault: \"CURRENT_TIMESTAMP\",\n deleteDate: \"timestamp\",\n deleteDateNullable: true,\n version: \"integer\",\n treeLevel: \"integer\",\n migrationId: \"integer\",\n migrationName: \"nvarchar\",\n migrationTimestamp: \"bigint\",\n cacheId: \"integer\",\n cacheIdentifier: \"nvarchar\",\n cacheTime: \"bigint\",\n cacheDuration: \"integer\",\n cacheQuery: \"nvarchar(5000)\" as any,\n cacheResult: \"text\",\n metadataType: \"nvarchar\",\n metadataDatabase: \"nvarchar\",\n metadataSchema: \"nvarchar\",\n metadataTable: \"nvarchar\",\n metadataName: \"nvarchar\",\n metadataValue: \"nvarchar(5000)\" as any,\n }\n\n /**\n * Default values of length, precision and scale depends on column data type.\n * Used in the cases when length/precision/scale is not specified by user.\n */\n dataTypeDefaults: DataTypeDefaults = {\n char: { length: 1 },\n nchar: { length: 1 },\n varchar: { length: 255 },\n nvarchar: { length: 255 },\n shorttext: { length: 255 },\n varbinary: { length: 255 },\n decimal: { precision: 18, scale: 0 },\n }\n\n /**\n * Max length allowed by SAP HANA for aliases (identifiers).\n * @see https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/20a760537519101497e3cfe07b348f3c.html\n */\n maxAliasLength = 128\n\n cteCapabilities: CteCapabilities = {\n enabled: true,\n }\n\n dummyTableName = `SYS.DUMMY`\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(connection: DataSource) {\n this.connection = connection\n this.options = connection.options as SapConnectionOptions\n this.loadDependencies()\n\n this.database = DriverUtils.buildDriverOptions(this.options).database\n this.schema = DriverUtils.buildDriverOptions(this.options).schema\n }\n\n // -------------------------------------------------------------------------\n // Public Implemented Methods\n // -------------------------------------------------------------------------\n\n /**\n * Performs connection to the database.\n * Based on pooling options, it can either create connection immediately,\n * either create a pool and create connection when needed.\n */\n async connect(): Promise<void> {\n // HANA connection info\n const dbParams = {\n hostName: this.options.host,\n port: this.options.port,\n userName: this.options.username,\n password: this.options.password,\n ...this.options.extra,\n }\n\n if (this.options.database) dbParams.databaseName = this.options.database\n if (this.options.encrypt) dbParams.encrypt = this.options.encrypt\n if (this.options.sslValidateCertificate)\n dbParams.validateCertificate = this.options.sslValidateCertificate\n if (this.options.key) dbParams.key = this.options.key\n if (this.options.cert) dbParams.cert = this.options.cert\n if (this.options.ca) dbParams.ca = this.options.ca\n\n // pool options\n const options: any = {\n min:\n this.options.pool && this.options.pool.min\n ? this.options.pool.min\n : 1,\n max:\n this.options.pool && this.options.pool.max\n ? this.options.pool.max\n : 10,\n }\n\n if (this.options.pool && this.options.pool.checkInterval)\n options.checkInterval = this.options.pool.checkInterval\n if (this.options.pool && this.options.pool.maxWaitingRequests)\n options.maxWaitingRequests = this.options.pool.maxWaitingRequests\n if (this.options.pool && this.options.pool.requestTimeout)\n options.requestTimeout = this.options.pool.requestTimeout\n if (this.options.pool && this.options.pool.idleTimeout)\n options.idleTimeout = this.options.pool.idleTimeout\n\n const { logger } = this.connection\n\n const poolErrorHandler =\n options.poolErrorHandler ||\n ((error: any) =>\n logger.log(\"warn\", `SAP Hana pool raised an error. ${error}`))\n this.client.eventEmitter.on(\"poolError\", poolErrorHandler)\n\n // create the pool\n this.master = this.client.createPool(dbParams, options)\n\n if (!this.database || !this.schema) {\n const queryRunner = await this.createQueryRunner(\"master\")\n\n if (!this.database) {\n this.database = await queryRunner.getCurrentDatabase()\n }\n\n if (!this.schema) {\n this.schema = await queryRunner.getCurrentSchema()\n }\n\n await queryRunner.release()\n }\n }\n\n /**\n * Makes any action after connection (e.g. create extensions in Postgres driver).\n */\n afterConnect(): Promise<void> {\n return Promise.resolve()\n }\n\n /**\n * Closes connection with the database.\n */\n async disconnect(): Promise<void> {\n const promise = this.master.clear()\n this.master = undefined\n return promise\n }\n\n /**\n * Creates a schema builder used to build and sync a schema.\n */\n createSchemaBuilder() {\n return new RdbmsSchemaBuilder(this.connection)\n }\n\n /**\n * Creates a query runner used to execute database queries.\n */\n createQueryRunner(mode: ReplicationMode) {\n return new SapQueryRunner(this, mode)\n }\n\n /**\n * Replaces parameters in the given sql with special escaping character\n * and an array of parameter names to be passed to a query.\n */\n escapeQueryWithParameters(\n sql: string,\n parameters: ObjectLiteral,\n nativeParameters: ObjectLiteral,\n ): [string, any[]] {\n const escapedParameters: any[] = Object.keys(nativeParameters).map(\n (key) => {\n if (nativeParameters[key] instanceof Date)\n return DateUtils.mixedDateToDatetimeString(\n nativeParameters[key],\n true,\n )\n\n return nativeParameters[key]\n },\n )\n\n if (!parameters || !Object.keys(parameters).length)\n return [sql, escapedParameters]\n\n sql = sql.replace(\n /:(\\.\\.\\.)?([A-Za-z0-9_.]+)/g,\n (full, isArray: string, key: string): string => {\n if (!parameters.hasOwnProperty(key)) {\n return full\n }\n\n let value: any = parameters[key]\n\n if (isArray) {\n return value\n .map((v: any) => {\n escapedParameters.push(v)\n return this.createParameter(\n key,\n escapedParameters.length - 1,\n )\n })\n .join(\", \")\n }\n\n if (typeof value === \"function\") {\n return value()\n }\n\n if (value instanceof Date) {\n return DateUtils.mixedDateToDatetimeString(value, true)\n }\n\n escapedParameters.push(value)\n return this.createParameter(key, escapedParameters.length - 1)\n },\n ) // todo: make replace only in value statements, otherwise problems\n return [sql, escapedParameters]\n }\n\n /**\n * Escapes a column name.\n */\n escape(columnName: string): string {\n return `\"${columnName}\"`\n }\n\n /**\n * Build full table name with schema name and table name.\n * E.g. myDB.mySchema.myTable\n */\n buildTableName(tableName: string, schema?: string): string {\n let tablePath = [tableName]\n\n if (schema) {\n tablePath.unshift(schema)\n }\n\n return tablePath.join(\".\")\n }\n\n /**\n * Parse a target table name or other types and return a normalized table definition.\n */\n parseTableName(\n target: EntityMetadata | Table | View | TableForeignKey | string,\n ): { database?: string; schema?: string; tableName: string } {\n const driverDatabase = this.database\n const driverSchema = this.schema\n\n if (InstanceChecker.isTable(target) || InstanceChecker.isView(target)) {\n const parsed = this.parseTableName(target.name)\n\n return {\n database: target.database || parsed.database || driverDatabase,\n schema: target.schema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isTableForeignKey(target)) {\n const parsed = this.parseTableName(target.referencedTableName)\n\n return {\n database:\n target.referencedDatabase ||\n parsed.database ||\n driverDatabase,\n schema:\n target.referencedSchema || parsed.schema || driverSchema,\n tableName: parsed.tableName,\n }\n }\n\n if (InstanceChecker.isEntityMetadata(target)) {\n // EntityMetadata tableName is never a path\n\n return {\n database: target.database || driverDatabase,\n schema: target.schema || driverSchema,\n tableName: target.tableName,\n }\n }\n\n const parts = target.split(\".\")\n\n return {\n database: driverDatabase,\n schema: (parts.length > 1 ? parts[0] : undefined) || driverSchema,\n tableName: parts.length > 1 ? parts[1] : parts[0],\n }\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type and metadata.\n */\n preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any {\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformTo(\n columnMetadata.transformer,\n value,\n )\n\n if (value === null || value === undefined) return value\n\n if (columnMetadata.type === Boolean) {\n return value === true ? 1 : 0\n } else if (columnMetadata.type === \"date\") {\n return DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n return DateUtils.mixedDateToTimeString(value)\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === Date\n ) {\n return DateUtils.mixedDateToDatetimeString(value, true)\n } else if (columnMetadata.type === \"seconddate\") {\n return DateUtils.mixedDateToDatetimeString(value, false)\n } else if (columnMetadata.type === \"simple-array\") {\n return DateUtils.simpleArrayToString(value)\n } else if (columnMetadata.type === \"simple-json\") {\n return DateUtils.simpleJsonToString(value)\n } else if (columnMetadata.type === \"simple-enum\") {\n return DateUtils.simpleEnumToString(value)\n } else if (columnMetadata.isArray) {\n return () => `ARRAY(${value.map((it: any) => `'${it}'`)})`\n }\n\n return value\n }\n\n /**\n * Prepares given value to a value to be persisted, based on its column type or metadata.\n */\n prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any {\n if (value === null || value === undefined)\n return columnMetadata.transformer\n ? ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n : value\n\n if (columnMetadata.type === Boolean) {\n value = value ? true : false\n } else if (\n columnMetadata.type === \"timestamp\" ||\n columnMetadata.type === \"seconddate\" ||\n columnMetadata.type === Date\n ) {\n value = DateUtils.normalizeHydratedDate(value)\n } else if (columnMetadata.type === \"date\") {\n value = DateUtils.mixedDateToDateString(value)\n } else if (columnMetadata.type === \"time\") {\n value = DateUtils.mixedTimeToString(value)\n } else if (columnMetadata.type === \"simple-array\") {\n value = DateUtils.stringToSimpleArray(value)\n } else if (columnMetadata.type === \"simple-json\") {\n value = DateUtils.stringToSimpleJson(value)\n } else if (columnMetadata.type === \"simple-enum\") {\n value = DateUtils.stringToSimpleEnum(value, columnMetadata)\n } else if (columnMetadata.type === Number) {\n // convert to number if number\n value = !isNaN(+value) ? parseInt(value) : value\n }\n\n if (columnMetadata.transformer)\n value = ApplyValueTransformers.transformFrom(\n columnMetadata.transformer,\n value,\n )\n\n return value\n }\n\n /**\n * Creates a database type from a given column metadata.\n */\n normalizeType(column: {\n type?: ColumnType\n length?: number | string\n precision?: number | null\n scale?: number\n }): string {\n if (column.type === Number || column.type === \"int\") {\n return \"integer\"\n } else if (column.type === String) {\n return \"nvarchar\"\n } else if (column.type === Date) {\n return \"timestamp\"\n } else if (column.type === Boolean) {\n return \"boolean\"\n } else if ((column.type as any) === Buffer) {\n return \"blob\"\n } else if (column.type === \"uuid\") {\n return \"nvarchar\"\n } else if (\n column.type === \"simple-array\" ||\n column.type === \"simple-json\"\n ) {\n return \"text\"\n } else if (column.type === \"simple-enum\") {\n return \"nvarchar\"\n } else {\n return (column.type as string) || \"\"\n }\n }\n\n /**\n * Normalizes \"default\" value of the column.\n */\n normalizeDefault(columnMetadata: ColumnMetadata): string | undefined {\n const defaultValue = columnMetadata.default\n\n if (typeof defaultValue === \"number\") {\n return `${defaultValue}`\n }\n\n if (typeof defaultValue === \"boolean\") {\n return defaultValue ? \"true\" : \"false\"\n }\n\n if (typeof defaultValue === \"function\") {\n return defaultValue()\n }\n\n if (typeof defaultValue === \"string\") {\n return `'${defaultValue}'`\n }\n\n if (defaultValue === null || defaultValue === undefined) {\n return undefined\n }\n\n return `${defaultValue}`\n }\n\n /**\n * Normalizes \"isUnique\" value of the column.\n */\n normalizeIsUnique(column: ColumnMetadata): boolean {\n return column.entityMetadata.indices.some(\n (idx) =>\n idx.isUnique &&\n idx.columns.length === 1 &&\n idx.columns[0] === column,\n )\n }\n\n /**\n * Returns default column lengths, which is required on column creation.\n */\n getColumnLength(column: ColumnMetadata | TableColumn): string {\n if (column.length) return column.length.toString()\n\n if (column.generationStrategy === \"uuid\") return \"36\"\n\n switch (column.type) {\n case \"varchar\":\n case \"nvarchar\":\n case \"shorttext\":\n case String:\n return \"255\"\n case \"alphanum\":\n return \"127\"\n case \"varbinary\":\n return \"255\"\n }\n\n return \"\"\n }\n\n /**\n * Creates column type definition including length, precision and scale\n */\n createFullType(column: TableColumn): string {\n let type = column.type\n\n // used 'getColumnLength()' method, because SqlServer sets `varchar` and `nvarchar` length to 1 by default.\n if (this.getColumnLength(column)) {\n type += `(${this.getColumnLength(column)})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined &&\n column.scale !== null &&\n column.scale !== undefined\n ) {\n type += `(${column.precision},${column.scale})`\n } else if (\n column.precision !== null &&\n column.precision !== undefined\n ) {\n type += `(${column.precision})`\n }\n\n if (column.isArray) type += \" array\"\n\n return type\n }\n\n /**\n * Obtains a new database connection to a master server.\n * Used for replication.\n * If replication is not setup then returns default connection's database connection.\n */\n obtainMasterConnection(): Promise<any> {\n if (!this.master) {\n throw new TypeORMError(\"Driver not Connected\")\n }\n\n return this.master.getConnection()\n }\n\n /**\n * Obtains a new database connection to a slave server.\n * Used for replication.\n * If replication is not setup then returns master (default) connection's database connection.\n */\n obtainSlaveConnection(): Promise<any> {\n return this.obtainMasterConnection()\n }\n\n /**\n * Creates generated map of values generated or returned by database after INSERT query.\n */\n createGeneratedMap(metadata: EntityMetadata, insertResult: ObjectLiteral) {\n const generatedMap = metadata.generatedColumns.reduce(\n (map, generatedColumn) => {\n let value: any\n if (\n generatedColumn.generationStrategy === \"increment\" &&\n insertResult\n ) {\n value = insertResult\n // } else if (generatedColumn.generationStrategy === \"uuid\") {\n // console.log(\"getting db value:\", generatedColumn.databaseName);\n // value = generatedColumn.getEntityValue(uuidMap);\n }\n\n return OrmUtils.mergeDeep(\n map,\n generatedColumn.createValueMap(value),\n )\n },\n {} as ObjectLiteral,\n )\n\n return Object.keys(generatedMap).length > 0 ? generatedMap : undefined\n }\n\n /**\n * Differentiate columns of this table and columns from the given column metadatas columns\n * and returns only changed.\n */\n findChangedColumns(\n tableColumns: TableColumn[],\n columnMetadatas: ColumnMetadata[],\n ): ColumnMetadata[] {\n return columnMetadatas.filter((columnMetadata) => {\n const tableColumn = tableColumns.find(\n (c) => c.name === columnMetadata.databaseName,\n )\n if (!tableColumn) return false // we don't need new columns, we only need exist and changed\n\n // console.log(\"table:\", columnMetadata.entityMetadata.tableName);\n // console.log(\"name:\", tableColumn.name, columnMetadata.databaseName);\n // console.log(\"type:\", tableColumn.type, _this.normalizeType(columnMetadata));\n // console.log(\"length:\", tableColumn.length, _this.getColumnLength(columnMetadata));\n // console.log(\"width:\", tableColumn.width, columnMetadata.width);\n // console.log(\"precision:\", tableColumn.precision, columnMetadata.precision);\n // console.log(\"scale:\", tableColumn.scale, columnMetadata.scale);\n // console.log(\"default:\", tableColumn.default, columnMetadata.default);\n // console.log(\"isPrimary:\", tableColumn.isPrimary, columnMetadata.isPrimary);\n // console.log(\"isNullable:\", tableColumn.isNullable, columnMetadata.isNullable);\n // console.log(\"isUnique:\", tableColumn.isUnique, _this.normalizeIsUnique(columnMetadata));\n // console.log(\"isGenerated:\", tableColumn.isGenerated, columnMetadata.isGenerated);\n // console.log((columnMetadata.generationStrategy !== \"uuid\" && tableColumn.isGenerated !== columnMetadata.isGenerated));\n // console.log(\"==========================================\");\n\n const normalizeDefault = this.normalizeDefault(columnMetadata)\n const hanaNullComapatibleDefault =\n normalizeDefault == null ? undefined : normalizeDefault\n\n return (\n tableColumn.name !== columnMetadata.databaseName ||\n tableColumn.type !== this.normalizeType(columnMetadata) ||\n (columnMetadata.length &&\n tableColumn.length !==\n this.getColumnLength(columnMetadata)) ||\n tableColumn.precision !== columnMetadata.precision ||\n tableColumn.scale !== columnMetadata.scale ||\n // || tableColumn.comment !== columnMetadata.comment || // todo\n (!tableColumn.isGenerated &&\n hanaNullComapatibleDefault !== tableColumn.default) || // we included check for generated here, because generated columns already can have default values\n tableColumn.isPrimary !== columnMetadata.isPrimary ||\n tableColumn.isNullable !== columnMetadata.isNullable ||\n tableColumn.isUnique !==\n this.normalizeIsUnique(columnMetadata) ||\n (columnMetadata.generationStrategy !== \"uuid\" &&\n tableColumn.isGenerated !== columnMetadata.isGenerated)\n )\n })\n }\n\n /**\n * Returns true if driver supports RETURNING / OUTPUT statement.\n */\n isReturningSqlSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports uuid values generation on its own.\n */\n isUUIDGenerationSupported(): boolean {\n return false\n }\n\n /**\n * Returns true if driver supports fulltext indices.\n */\n isFullTextColumnTypeSupported(): boolean {\n return true\n }\n\n /**\n * Creates an escaped parameter.\n */\n createParameter(parameterName: string, index: number): string {\n return \"?\"\n }\n\n // -------------------------------------------------------------------------\n // Protected Methods\n // -------------------------------------------------------------------------\n\n /**\n * If driver dependency is not given explicitly, then try to load it via \"require\".\n */\n protected loadDependencies(): void {\n try {\n const client = this.options.driver || PlatformTools.load(\"hdb-pool\")\n this.client = client\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\"SAP Hana\", \"hdb-pool\")\n }\n\n try {\n if (!this.options.hanaClientDriver) {\n PlatformTools.load(\"@sap/hana-client\")\n }\n } catch (e) {\n // todo: better error for browser env\n throw new DriverPackageNotInstalledError(\n \"SAP Hana\",\n \"@sap/hana-client\",\n )\n }\n }\n}\n"],"sourceRoot":"../.."}
@@ -1,11 +1,12 @@
1
1
  import { DefaultAuthentication } from "./authentication/DefaultAuthentication";
2
2
  import { AzureActiveDirectoryAccessTokenAuthentication } from "./authentication/AzureActiveDirectoryAccessTokenAuthentication";
3
+ import { AzureActiveDirectoryDefaultAuthentication } from "./authentication/AzureActiveDirectoryDefaultAuthentication";
3
4
  import { AzureActiveDirectoryMsiAppServiceAuthentication } from "./authentication/AzureActiveDirectoryMsiAppServiceAuthentication";
4
5
  import { AzureActiveDirectoryMsiVmAuthentication } from "./authentication/AzureActiveDirectoryMsiVmAuthentication";
5
6
  import { AzureActiveDirectoryPasswordAuthentication } from "./authentication/AzureActiveDirectoryPasswordAuthentication";
6
7
  import { AzureActiveDirectoryServicePrincipalSecret } from "./authentication/AzureActiveDirectoryServicePrincipalSecret";
7
8
  import { NtlmAuthentication } from "./authentication/NtlmAuthentication";
8
- export type SqlServerConnectionCredentialsAuthenticationOptions = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryServicePrincipalSecret;
9
+ export type SqlServerConnectionCredentialsAuthenticationOptions = DefaultAuthentication | NtlmAuthentication | AzureActiveDirectoryAccessTokenAuthentication | AzureActiveDirectoryDefaultAuthentication | AzureActiveDirectoryMsiAppServiceAuthentication | AzureActiveDirectoryMsiVmAuthentication | AzureActiveDirectoryPasswordAuthentication | AzureActiveDirectoryServicePrincipalSecret;
9
10
  /**
10
11
  * SqlServer specific connection credential options.
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionCredentialsOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionCredentialsOptions.js","sourcesContent":["import { DefaultAuthentication } from \"./authentication/DefaultAuthentication\"\nimport { AzureActiveDirectoryAccessTokenAuthentication } from \"./authentication/AzureActiveDirectoryAccessTokenAuthentication\"\nimport { AzureActiveDirectoryMsiAppServiceAuthentication } from \"./authentication/AzureActiveDirectoryMsiAppServiceAuthentication\"\nimport { AzureActiveDirectoryMsiVmAuthentication } from \"./authentication/AzureActiveDirectoryMsiVmAuthentication\"\nimport { AzureActiveDirectoryPasswordAuthentication } from \"./authentication/AzureActiveDirectoryPasswordAuthentication\"\nimport { AzureActiveDirectoryServicePrincipalSecret } from \"./authentication/AzureActiveDirectoryServicePrincipalSecret\"\nimport { NtlmAuthentication } from \"./authentication/NtlmAuthentication\"\n\nexport type SqlServerConnectionCredentialsAuthenticationOptions =\n | DefaultAuthentication\n | NtlmAuthentication\n | AzureActiveDirectoryAccessTokenAuthentication\n | AzureActiveDirectoryMsiAppServiceAuthentication\n | AzureActiveDirectoryMsiVmAuthentication\n | AzureActiveDirectoryPasswordAuthentication\n | AzureActiveDirectoryServicePrincipalSecret\n\n/**\n * SqlServer specific connection credential options.\n */\nexport interface SqlServerConnectionCredentialsOptions {\n /**\n * Connection url where perform connection to.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Authentication settings\n * It overrides username and password, when passed.\n */\n readonly authentication?: SqlServerConnectionCredentialsAuthenticationOptions\n\n /**\n * Once you set domain, driver will connect to SQL Server using domain login.\n * @see SqlServerConnectionCredentialsOptions.authentication\n * @see NtlmAuthentication\n * @deprecated\n */\n readonly domain?: string\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionCredentialsOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionCredentialsOptions.js","sourcesContent":["import { DefaultAuthentication } from \"./authentication/DefaultAuthentication\"\nimport { AzureActiveDirectoryAccessTokenAuthentication } from \"./authentication/AzureActiveDirectoryAccessTokenAuthentication\"\nimport { AzureActiveDirectoryDefaultAuthentication } from \"./authentication/AzureActiveDirectoryDefaultAuthentication\"\nimport { AzureActiveDirectoryMsiAppServiceAuthentication } from \"./authentication/AzureActiveDirectoryMsiAppServiceAuthentication\"\nimport { AzureActiveDirectoryMsiVmAuthentication } from \"./authentication/AzureActiveDirectoryMsiVmAuthentication\"\nimport { AzureActiveDirectoryPasswordAuthentication } from \"./authentication/AzureActiveDirectoryPasswordAuthentication\"\nimport { AzureActiveDirectoryServicePrincipalSecret } from \"./authentication/AzureActiveDirectoryServicePrincipalSecret\"\nimport { NtlmAuthentication } from \"./authentication/NtlmAuthentication\"\n\nexport type SqlServerConnectionCredentialsAuthenticationOptions =\n | DefaultAuthentication\n | NtlmAuthentication\n | AzureActiveDirectoryAccessTokenAuthentication\n | AzureActiveDirectoryDefaultAuthentication\n | AzureActiveDirectoryMsiAppServiceAuthentication\n | AzureActiveDirectoryMsiVmAuthentication\n | AzureActiveDirectoryPasswordAuthentication\n | AzureActiveDirectoryServicePrincipalSecret\n\n/**\n * SqlServer specific connection credential options.\n */\nexport interface SqlServerConnectionCredentialsOptions {\n /**\n * Connection url where perform connection to.\n */\n readonly url?: string\n\n /**\n * Database host.\n */\n readonly host?: string\n\n /**\n * Database host port.\n */\n readonly port?: number\n\n /**\n * Database name to connect to.\n */\n readonly database?: string\n\n /**\n * Database username.\n */\n readonly username?: string\n\n /**\n * Database password.\n */\n readonly password?: string\n\n /**\n * Authentication settings\n * It overrides username and password, when passed.\n */\n readonly authentication?: SqlServerConnectionCredentialsAuthenticationOptions\n\n /**\n * Once you set domain, driver will connect to SQL Server using domain login.\n * @see SqlServerConnectionCredentialsOptions.authentication\n * @see NtlmAuthentication\n * @deprecated\n */\n readonly domain?: string\n}\n"],"sourceRoot":"../.."}
@@ -148,6 +148,11 @@ export interface SqlServerConnectionOptions extends BaseDataSourceOptions, SqlSe
148
148
  * A boolean, controlling whatever to disable RETURNING / OUTPUT statements.
149
149
  */
150
150
  readonly disableOutputReturning?: boolean;
151
+ /**
152
+ * A boolean, controlling whether MssqlParameter types char, varchar, and text are converted to their unicode equivalents, nchar, nvarchar, and ntext.
153
+ * (default: false, meaning that char/varchar/text parameters will be converted to nchar/nvarchar/ntext)
154
+ */
155
+ readonly disableAsciiToUnicodeParamConversion?: boolean;
151
156
  /**
152
157
  * Debug options
153
158
  */
@@ -1 +1 @@
1
- {"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { SqlServerConnectionCredentialsOptions } from \"./SqlServerConnectionCredentialsOptions\"\n\n/**\n * Microsoft Sql Server specific connection options.\n */\nexport interface SqlServerConnectionOptions\n extends BaseDataSourceOptions,\n SqlServerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"mssql\"\n\n /**\n * Connection timeout in ms (default: 15000).\n */\n readonly connectionTimeout?: number\n\n /**\n * Request timeout in ms (default: 15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second.\n */\n readonly requestTimeout?: number\n\n /**\n * Stream recordsets/rows instead of returning them all at once as an argument of callback (default: false).\n * You can also enable streaming for each request independently (request.stream = true).\n * Always set to true if you plan to work with large amount of rows.\n */\n readonly stream?: boolean\n\n /**\n * Database schema.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"mssql\")`\n */\n readonly driver?: any\n\n /**\n * An optional object/dictionary with the any of the properties\n */\n readonly pool?: {\n /**\n * Maximum number of resources to create at any given time. (default=1)\n */\n readonly max?: number\n\n /**\n * Minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently\n * set the min to equal max. (default=0)\n */\n readonly min?: number\n\n /**\n * Maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future\n * cycle of the event loop.\n */\n readonly maxWaitingClients?: number\n\n /**\n * Should the pool validate resources before giving them to clients. Requires that either factory.validate or\n * factory.validateAsync to be specified\n */\n readonly testOnBorrow?: boolean\n\n /**\n * Max milliseconds an acquire call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.\n */\n readonly acquireTimeoutMillis?: number\n\n /**\n * If true the oldest resources will be first to be allocated. If false the most recently released resources will\n * be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean,\n * (default true)\n */\n readonly fifo?: boolean\n\n /**\n * Int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources\n * are available. see example. (default 1)\n */\n readonly priorityRange?: number\n\n /**\n * How often to run eviction checks. Default: 0 (does not run).\n */\n readonly evictionRunIntervalMillis?: number\n\n /**\n * Number of resources to check each eviction run. Default: 3.\n */\n readonly numTestsPerRun?: number\n\n /**\n * Amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object\n * evictor (if any), with the extra condition that at least \"min idle\" object instances remain in the pool.\n * Default -1 (nothing can get evicted)\n */\n readonly softIdleTimeoutMillis?: number\n\n /**\n * The minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due\n * to idle time. Supercedes softIdleTimeoutMillis Default: 30000\n */\n readonly idleTimeoutMillis?: number\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly errorHandler?: (err: any) => any\n }\n\n /**\n * Extra options\n */\n readonly options?: {\n /**\n * The named instance to connect to\n */\n readonly instanceName?: string\n\n /**\n * By default, if the database requestion by options.database cannot be accessed, the connection will fail with\n * an error. However, if options.fallbackToDefaultDb is set to true, then the user's default database will\n * be used instead (Default: false).\n */\n readonly fallbackToDefaultDb?: boolean\n\n /**\n * If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by\n * default. See the T-SQL documentation for more details. (Default: true).\n */\n readonly enableAnsiNullDefault?: boolean\n\n /**\n * The number of milliseconds before the attempt to connect is considered failed (default: 15000).\n */\n readonly connectTimeout?: number\n\n /**\n * The number of milliseconds before the cancel (abort) of a request is considered failed (default: 5000).\n */\n readonly cancelTimeout?: number\n\n /**\n * The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default: 4096).\n */\n readonly packetSize?: number\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 * A boolean determining whether to rollback a transaction automatically if any error is encountered during\n * the given transaction's execution. This sets the value for SET XACT_ABORT during the initial SQL phase\n * of a connection (documentation).\n */\n readonly abortTransactionOnError?: boolean\n\n /**\n * A string indicating which network interface (ip address) to use when connecting to SQL Server.\n */\n readonly localAddress?: string\n\n /**\n * A boolean determining whether to return rows as arrays or key-value collections. (default: false).\n */\n readonly useColumnNames?: boolean\n\n /**\n * A boolean, controlling whether the column names returned will have the first letter converted to lower case\n * (true) or not. This value is ignored if you provide a columnNameReplacer. (default: false).\n */\n readonly camelCaseColumns?: boolean\n\n /**\n * A boolean, controlling whatever to disable RETURNING / OUTPUT statements.\n */\n readonly disableOutputReturning?: boolean\n\n /**\n * Debug options\n */\n readonly debug?: {\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet details\n * (default: false).\n */\n readonly packet?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet data details\n * (default: false).\n */\n readonly data?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet payload details\n * (default: false).\n */\n readonly payload?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing token stream tokens\n * (default: false).\n */\n readonly token?: boolean\n }\n\n /**\n * The default isolation level that transactions will be run with. The isolation levels are available\n * from require('tedious').ISOLATION_LEVEL. (default: READ_COMMITTED).\n */\n readonly isolation?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * The default isolation level for new connections. All out-of-transaction queries are executed with this\n * setting. The isolation levels are available from require('tedious').ISOLATION_LEVEL .\n */\n readonly connectionIsolationLevel?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * A boolean, determining whether the connection will request read only access from a SQL Server\n * Availability Group. For more information, see here. (default: false).\n */\n readonly readOnlyIntent?: boolean\n\n /**\n * A boolean determining whether or not the connection will be encrypted. Set to true if you're on\n * Windows Azure. (default: true).\n */\n readonly encrypt?: boolean\n\n /**\n * When encryption is used, an object may be supplied that will be used for the first argument when calling\n * tls.createSecurePair (default: {}).\n */\n readonly cryptoCredentialsDetails?: any\n\n /**\n * A boolean, that when true will expose received rows in Requests' done* events. See done, doneInProc and\n * doneProc. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnDone?: boolean\n\n /**\n * A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnRequestCompletion?: boolean\n\n /**\n * The version of TDS to use. If server doesn't support specified version, negotiated version is used instead.\n * The versions are available from require('tedious').TDS_VERSION. (default: 7_4).\n */\n readonly tdsVersion?: string\n\n /**\n * A boolean, that when true will abort a query when an overflow or divide-by-zero error occurs during query execution.\n */\n readonly enableArithAbort?: boolean\n\n /**\n * Application name used for identifying a specific application in profiling, logging or tracing tools of SQL Server.\n * (default: node-mssql)\n */\n readonly appName?: string\n\n /**\n * A boolean, controlling whether encryption occurs if there is no verifiable server certificate.\n * (default: false)\n */\n readonly trustServerCertificate?: boolean\n }\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SqlServerConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: SqlServerConnectionCredentialsOptions[]\n }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
1
+ {"version":3,"sources":["../browser/src/driver/sqlserver/SqlServerConnectionOptions.ts"],"names":[],"mappings":"","file":"SqlServerConnectionOptions.js","sourcesContent":["import { BaseDataSourceOptions } from \"../../data-source/BaseDataSourceOptions\"\nimport { SqlServerConnectionCredentialsOptions } from \"./SqlServerConnectionCredentialsOptions\"\n\n/**\n * Microsoft Sql Server specific connection options.\n */\nexport interface SqlServerConnectionOptions\n extends BaseDataSourceOptions,\n SqlServerConnectionCredentialsOptions {\n /**\n * Database type.\n */\n readonly type: \"mssql\"\n\n /**\n * Connection timeout in ms (default: 15000).\n */\n readonly connectionTimeout?: number\n\n /**\n * Request timeout in ms (default: 15000). NOTE: msnodesqlv8 driver doesn't support timeouts < 1 second.\n */\n readonly requestTimeout?: number\n\n /**\n * Stream recordsets/rows instead of returning them all at once as an argument of callback (default: false).\n * You can also enable streaming for each request independently (request.stream = true).\n * Always set to true if you plan to work with large amount of rows.\n */\n readonly stream?: boolean\n\n /**\n * Database schema.\n */\n readonly schema?: string\n\n /**\n * The driver object\n * This defaults to `require(\"mssql\")`\n */\n readonly driver?: any\n\n /**\n * An optional object/dictionary with the any of the properties\n */\n readonly pool?: {\n /**\n * Maximum number of resources to create at any given time. (default=1)\n */\n readonly max?: number\n\n /**\n * Minimum number of resources to keep in pool at any given time. If this is set >= max, the pool will silently\n * set the min to equal max. (default=0)\n */\n readonly min?: number\n\n /**\n * Maximum number of queued requests allowed, additional acquire calls will be callback with an err in a future\n * cycle of the event loop.\n */\n readonly maxWaitingClients?: number\n\n /**\n * Should the pool validate resources before giving them to clients. Requires that either factory.validate or\n * factory.validateAsync to be specified\n */\n readonly testOnBorrow?: boolean\n\n /**\n * Max milliseconds an acquire call will wait for a resource before timing out. (default no limit), if supplied should non-zero positive integer.\n */\n readonly acquireTimeoutMillis?: number\n\n /**\n * If true the oldest resources will be first to be allocated. If false the most recently released resources will\n * be the first to be allocated. This in effect turns the pool's behaviour from a queue into a stack. boolean,\n * (default true)\n */\n readonly fifo?: boolean\n\n /**\n * Int between 1 and x - if set, borrowers can specify their relative priority in the queue if no resources\n * are available. see example. (default 1)\n */\n readonly priorityRange?: number\n\n /**\n * How often to run eviction checks. Default: 0 (does not run).\n */\n readonly evictionRunIntervalMillis?: number\n\n /**\n * Number of resources to check each eviction run. Default: 3.\n */\n readonly numTestsPerRun?: number\n\n /**\n * Amount of time an object may sit idle in the pool before it is eligible for eviction by the idle object\n * evictor (if any), with the extra condition that at least \"min idle\" object instances remain in the pool.\n * Default -1 (nothing can get evicted)\n */\n readonly softIdleTimeoutMillis?: number\n\n /**\n * The minimum amount of time that an object may sit idle in the pool before it is eligible for eviction due\n * to idle time. Supercedes softIdleTimeoutMillis Default: 30000\n */\n readonly idleTimeoutMillis?: number\n\n /*\n * Function handling errors thrown by drivers pool.\n * Defaults to logging error with `warn` level.\n */\n readonly errorHandler?: (err: any) => any\n }\n\n /**\n * Extra options\n */\n readonly options?: {\n /**\n * The named instance to connect to\n */\n readonly instanceName?: string\n\n /**\n * By default, if the database requestion by options.database cannot be accessed, the connection will fail with\n * an error. However, if options.fallbackToDefaultDb is set to true, then the user's default database will\n * be used instead (Default: false).\n */\n readonly fallbackToDefaultDb?: boolean\n\n /**\n * If true, SET ANSI_NULL_DFLT_ON ON will be set in the initial sql. This means new columns will be nullable by\n * default. See the T-SQL documentation for more details. (Default: true).\n */\n readonly enableAnsiNullDefault?: boolean\n\n /**\n * The number of milliseconds before the attempt to connect is considered failed (default: 15000).\n */\n readonly connectTimeout?: number\n\n /**\n * The number of milliseconds before the cancel (abort) of a request is considered failed (default: 5000).\n */\n readonly cancelTimeout?: number\n\n /**\n * The size of TDS packets (subject to negotiation with the server). Should be a power of 2. (default: 4096).\n */\n readonly packetSize?: number\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 * A boolean determining whether to rollback a transaction automatically if any error is encountered during\n * the given transaction's execution. This sets the value for SET XACT_ABORT during the initial SQL phase\n * of a connection (documentation).\n */\n readonly abortTransactionOnError?: boolean\n\n /**\n * A string indicating which network interface (ip address) to use when connecting to SQL Server.\n */\n readonly localAddress?: string\n\n /**\n * A boolean determining whether to return rows as arrays or key-value collections. (default: false).\n */\n readonly useColumnNames?: boolean\n\n /**\n * A boolean, controlling whether the column names returned will have the first letter converted to lower case\n * (true) or not. This value is ignored if you provide a columnNameReplacer. (default: false).\n */\n readonly camelCaseColumns?: boolean\n\n /**\n * A boolean, controlling whatever to disable RETURNING / OUTPUT statements.\n */\n readonly disableOutputReturning?: boolean\n\n /**\n * A boolean, controlling whether MssqlParameter types char, varchar, and text are converted to their unicode equivalents, nchar, nvarchar, and ntext.\n * (default: false, meaning that char/varchar/text parameters will be converted to nchar/nvarchar/ntext)\n */\n readonly disableAsciiToUnicodeParamConversion?: boolean\n\n /**\n * Debug options\n */\n readonly debug?: {\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet details\n * (default: false).\n */\n readonly packet?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet data details\n * (default: false).\n */\n readonly data?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing packet payload details\n * (default: false).\n */\n readonly payload?: boolean\n\n /**\n * A boolean, controlling whether debug events will be emitted with text describing token stream tokens\n * (default: false).\n */\n readonly token?: boolean\n }\n\n /**\n * The default isolation level that transactions will be run with. The isolation levels are available\n * from require('tedious').ISOLATION_LEVEL. (default: READ_COMMITTED).\n */\n readonly isolation?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * The default isolation level for new connections. All out-of-transaction queries are executed with this\n * setting. The isolation levels are available from require('tedious').ISOLATION_LEVEL .\n */\n readonly connectionIsolationLevel?:\n | \"READ_UNCOMMITTED\"\n | \"READ_COMMITTED\"\n | \"REPEATABLE_READ\"\n | \"SERIALIZABLE\"\n | \"SNAPSHOT\"\n\n /**\n * A boolean, determining whether the connection will request read only access from a SQL Server\n * Availability Group. For more information, see here. (default: false).\n */\n readonly readOnlyIntent?: boolean\n\n /**\n * A boolean determining whether or not the connection will be encrypted. Set to true if you're on\n * Windows Azure. (default: true).\n */\n readonly encrypt?: boolean\n\n /**\n * When encryption is used, an object may be supplied that will be used for the first argument when calling\n * tls.createSecurePair (default: {}).\n */\n readonly cryptoCredentialsDetails?: any\n\n /**\n * A boolean, that when true will expose received rows in Requests' done* events. See done, doneInProc and\n * doneProc. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnDone?: boolean\n\n /**\n * A boolean, that when true will expose received rows in Requests' completion callback. See new Request. (default: false)\n * Caution: If many row are received, enabling this option could result in excessive memory usage.\n */\n readonly rowCollectionOnRequestCompletion?: boolean\n\n /**\n * The version of TDS to use. If server doesn't support specified version, negotiated version is used instead.\n * The versions are available from require('tedious').TDS_VERSION. (default: 7_4).\n */\n readonly tdsVersion?: string\n\n /**\n * A boolean, that when true will abort a query when an overflow or divide-by-zero error occurs during query execution.\n */\n readonly enableArithAbort?: boolean\n\n /**\n * Application name used for identifying a specific application in profiling, logging or tracing tools of SQL Server.\n * (default: node-mssql)\n */\n readonly appName?: string\n\n /**\n * A boolean, controlling whether encryption occurs if there is no verifiable server certificate.\n * (default: false)\n */\n readonly trustServerCertificate?: boolean\n }\n\n /**\n * Replication setup.\n */\n readonly replication?: {\n /**\n * Master server used by orm to perform writes.\n */\n readonly master: SqlServerConnectionCredentialsOptions\n\n /**\n * List of read-from severs (slaves).\n */\n readonly slaves: SqlServerConnectionCredentialsOptions[]\n }\n\n readonly poolSize?: never\n}\n"],"sourceRoot":"../.."}
@@ -2368,6 +2368,7 @@ export class SqlServerQueryRunner extends BaseQueryRunner {
2368
2368
  * Converts MssqlParameter into real mssql parameter type.
2369
2369
  */
2370
2370
  mssqlParameterToNativeParameter(parameter) {
2371
+ var _a, _b, _c;
2371
2372
  switch (this.driver.normalizeType({ type: parameter.type })) {
2372
2373
  case "bit":
2373
2374
  return this.driver.mssql.Bit;
@@ -2392,12 +2393,24 @@ export class SqlServerQueryRunner extends BaseQueryRunner {
2392
2393
  case "tinyint":
2393
2394
  return this.driver.mssql.TinyInt;
2394
2395
  case "char":
2396
+ if ((_a = this.driver.options.options) === null || _a === void 0 ? void 0 : _a.disableAsciiToUnicodeParamConversion) {
2397
+ return this.driver.mssql.Char(...parameter.params);
2398
+ }
2399
+ return this.driver.mssql.NChar(...parameter.params);
2395
2400
  case "nchar":
2396
2401
  return this.driver.mssql.NChar(...parameter.params);
2397
2402
  case "text":
2403
+ if ((_b = this.driver.options.options) === null || _b === void 0 ? void 0 : _b.disableAsciiToUnicodeParamConversion) {
2404
+ return this.driver.mssql.Text;
2405
+ }
2406
+ return this.driver.mssql.Ntext;
2398
2407
  case "ntext":
2399
2408
  return this.driver.mssql.Ntext;
2400
2409
  case "varchar":
2410
+ if ((_c = this.driver.options.options) === null || _c === void 0 ? void 0 : _c.disableAsciiToUnicodeParamConversion) {
2411
+ return this.driver.mssql.VarChar(...parameter.params);
2412
+ }
2413
+ return this.driver.mssql.NVarChar(...parameter.params);
2401
2414
  case "nvarchar":
2402
2415
  return this.driver.mssql.NVarChar(...parameter.params);
2403
2416
  case "xml":