orcaq 1.0.20

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 (1018) hide show
  1. package/.output/nitro.json +15 -0
  2. package/.output/public/_nuxt/8qASMGdV.js +1 -0
  3. package/.output/public/_nuxt/9lJACZIQ.js +19 -0
  4. package/.output/public/_nuxt/B2DnNiWd.js +1 -0
  5. package/.output/public/_nuxt/B6E6ObS_.js +8 -0
  6. package/.output/public/_nuxt/BH83_dXo.js +39 -0
  7. package/.output/public/_nuxt/BIKqrFbQ.js +1 -0
  8. package/.output/public/_nuxt/BNjPC06x.js +1 -0
  9. package/.output/public/_nuxt/BPQ-Pz1w.js +39 -0
  10. package/.output/public/_nuxt/BRpgKkVT.js +51 -0
  11. package/.output/public/_nuxt/BTCLPbPY.js +4 -0
  12. package/.output/public/_nuxt/BUV-RarV.js +1 -0
  13. package/.output/public/_nuxt/Bh6RgYlO.js +1 -0
  14. package/.output/public/_nuxt/Bq3cyzOD.js +1 -0
  15. package/.output/public/_nuxt/Bt9sU68B.js +9 -0
  16. package/.output/public/_nuxt/BwpH2ZxJ.js +1 -0
  17. package/.output/public/_nuxt/C25Tmn1m.js +1 -0
  18. package/.output/public/_nuxt/C2HlI1ss.js +1 -0
  19. package/.output/public/_nuxt/CU3ZV9iV.js +1 -0
  20. package/.output/public/_nuxt/CbcyysXi.js +1 -0
  21. package/.output/public/_nuxt/CepyvMhE.js +1 -0
  22. package/.output/public/_nuxt/CrgoNCm2.js +2 -0
  23. package/.output/public/_nuxt/CuBKbBH_.js +1 -0
  24. package/.output/public/_nuxt/CulD8qYQ.js +193 -0
  25. package/.output/public/_nuxt/CustomEdge.BNBpjEHb.css +1 -0
  26. package/.output/public/_nuxt/CylkLpwm.js +1 -0
  27. package/.output/public/_nuxt/D-bWLYHw.js +1 -0
  28. package/.output/public/_nuxt/D-zecHND.js +1 -0
  29. package/.output/public/_nuxt/D8vj6kFe.js +160 -0
  30. package/.output/public/_nuxt/DIETYtCL.js +1 -0
  31. package/.output/public/_nuxt/DJ4vUzxS.js +1 -0
  32. package/.output/public/_nuxt/DK-itzXx.js +8 -0
  33. package/.output/public/_nuxt/DL3T5jYo.js +3867 -0
  34. package/.output/public/_nuxt/DUsuhY9i.js +1 -0
  35. package/.output/public/_nuxt/DXV2HFBA.js +224 -0
  36. package/.output/public/_nuxt/Dh2zppOR.js +1 -0
  37. package/.output/public/_nuxt/DlAUqK2U.js +1 -0
  38. package/.output/public/_nuxt/DlmSeCnw.js +5 -0
  39. package/.output/public/_nuxt/DswTpYG4.js +1 -0
  40. package/.output/public/_nuxt/DynamicTable.DJeANwbG.css +1 -0
  41. package/.output/public/_nuxt/G830WtVn.js +1 -0
  42. package/.output/public/_nuxt/ICwM1E4-.js +15 -0
  43. package/.output/public/_nuxt/QZbJy9YW.js +31 -0
  44. package/.output/public/_nuxt/QuickQueryTable.DS_ON57S.css +1 -0
  45. package/.output/public/_nuxt/UXhX8z2W.js +1 -0
  46. package/.output/public/_nuxt/WrapperErdDiagram.DwhUd9Wr.css +1 -0
  47. package/.output/public/_nuxt/_fileId_.DmPfwyyD.css +1 -0
  48. package/.output/public/_nuxt/_tabViewId_.9Axt3zoi.css +1 -0
  49. package/.output/public/_nuxt/builds/latest.json +1 -0
  50. package/.output/public/_nuxt/builds/meta/6364d5cf-4642-479f-ba12-6440c56702af.json +1 -0
  51. package/.output/public/_nuxt/default.DixIpIal.css +1 -0
  52. package/.output/public/_nuxt/entry.GqPNPe1e.css +1 -0
  53. package/.output/public/_nuxt/index.CrXmf4gr.css +1 -0
  54. package/.output/public/_nuxt/ivUnXl9B.js +1 -0
  55. package/.output/public/_nuxt/pAheHeBV.js +36 -0
  56. package/.output/public/_nuxt/s5fCn4j5.js +1 -0
  57. package/.output/public/favicon.ico +0 -0
  58. package/.output/public/logo.png +0 -0
  59. package/.output/public/manifest.json +25 -0
  60. package/.output/public/robots.txt +1 -0
  61. package/.output/public/vite.svg +1 -0
  62. package/.output/server/chunks/_/error-500.mjs +8 -0
  63. package/.output/server/chunks/_/error-500.mjs.map +1 -0
  64. package/.output/server/chunks/build/client.manifest.mjs +773 -0
  65. package/.output/server/chunks/build/client.manifest.mjs.map +1 -0
  66. package/.output/server/chunks/nitro/nitro.mjs +6432 -0
  67. package/.output/server/chunks/nitro/nitro.mjs.map +1 -0
  68. package/.output/server/chunks/routes/api/ai/chat.mjs +77 -0
  69. package/.output/server/chunks/routes/api/ai/chat.mjs.map +1 -0
  70. package/.output/server/chunks/routes/api/execute-bulk-delete.mjs +100 -0
  71. package/.output/server/chunks/routes/api/execute-bulk-delete.mjs.map +1 -0
  72. package/.output/server/chunks/routes/api/execute-bulk-update.mjs +105 -0
  73. package/.output/server/chunks/routes/api/execute-bulk-update.mjs.map +1 -0
  74. package/.output/server/chunks/routes/api/execute.mjs +47 -0
  75. package/.output/server/chunks/routes/api/execute.mjs.map +1 -0
  76. package/.output/server/chunks/routes/api/get-one-function.mjs +28 -0
  77. package/.output/server/chunks/routes/api/get-one-function.mjs.map +1 -0
  78. package/.output/server/chunks/routes/api/get-one-table.mjs +180 -0
  79. package/.output/server/chunks/routes/api/get-one-table.mjs.map +1 -0
  80. package/.output/server/chunks/routes/api/get-over-view-function.mjs +41 -0
  81. package/.output/server/chunks/routes/api/get-over-view-function.mjs.map +1 -0
  82. package/.output/server/chunks/routes/api/get-over-view-tables.mjs +53 -0
  83. package/.output/server/chunks/routes/api/get-over-view-tables.mjs.map +1 -0
  84. package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs +112 -0
  85. package/.output/server/chunks/routes/api/get-reverse-table-schemas.mjs.map +1 -0
  86. package/.output/server/chunks/routes/api/get-schema-meta-data.mjs +152 -0
  87. package/.output/server/chunks/routes/api/get-schema-meta-data.mjs.map +1 -0
  88. package/.output/server/chunks/routes/api/get-table-size.mjs +49 -0
  89. package/.output/server/chunks/routes/api/get-table-size.mjs.map +1 -0
  90. package/.output/server/chunks/routes/api/get-table-structure.mjs +111 -0
  91. package/.output/server/chunks/routes/api/get-table-structure.mjs.map +1 -0
  92. package/.output/server/chunks/routes/api/get-tables.mjs +287 -0
  93. package/.output/server/chunks/routes/api/get-tables.mjs.map +1 -0
  94. package/.output/server/chunks/routes/api/getMetricMonitor.mjs +46 -0
  95. package/.output/server/chunks/routes/api/getMetricMonitor.mjs.map +1 -0
  96. package/.output/server/chunks/routes/api/managment-connection/health-check.mjs +28 -0
  97. package/.output/server/chunks/routes/api/managment-connection/health-check.mjs.map +1 -0
  98. package/.output/server/chunks/routes/api/raw-execute.mjs +48 -0
  99. package/.output/server/chunks/routes/api/raw-execute.mjs.map +1 -0
  100. package/.output/server/chunks/routes/renderer.mjs +316 -0
  101. package/.output/server/chunks/routes/renderer.mjs.map +1 -0
  102. package/.output/server/chunks/virtual/_virtual_spa-template.mjs +4 -0
  103. package/.output/server/chunks/virtual/_virtual_spa-template.mjs.map +1 -0
  104. package/.output/server/index.mjs +14 -0
  105. package/.output/server/index.mjs.map +1 -0
  106. package/.output/server/node_modules/@ai-sdk/anthropic/dist/index.mjs +4374 -0
  107. package/.output/server/node_modules/@ai-sdk/anthropic/package.json +74 -0
  108. package/.output/server/node_modules/@ai-sdk/gateway/dist/index.mjs +1082 -0
  109. package/.output/server/node_modules/@ai-sdk/gateway/package.json +69 -0
  110. package/.output/server/node_modules/@ai-sdk/google/dist/index.mjs +2007 -0
  111. package/.output/server/node_modules/@ai-sdk/google/package.json +74 -0
  112. package/.output/server/node_modules/@ai-sdk/openai/dist/index.mjs +5956 -0
  113. package/.output/server/node_modules/@ai-sdk/openai/package.json +74 -0
  114. package/.output/server/node_modules/@ai-sdk/openai-compatible/dist/index.mjs +1551 -0
  115. package/.output/server/node_modules/@ai-sdk/openai-compatible/package.json +74 -0
  116. package/.output/server/node_modules/@ai-sdk/provider/dist/index.mjs +377 -0
  117. package/.output/server/node_modules/@ai-sdk/provider/package.json +57 -0
  118. package/.output/server/node_modules/@ai-sdk/provider-utils/dist/index.mjs +2549 -0
  119. package/.output/server/node_modules/@ai-sdk/provider-utils/package.json +75 -0
  120. package/.output/server/node_modules/@ai-sdk/xai/dist/index.mjs +2214 -0
  121. package/.output/server/node_modules/@ai-sdk/xai/package.json +68 -0
  122. package/.output/server/node_modules/@babel/parser/lib/index.js +14246 -0
  123. package/.output/server/node_modules/@babel/parser/package.json +50 -0
  124. package/.output/server/node_modules/@iconify/utils/lib/colors/index.mjs +350 -0
  125. package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.mjs +188 -0
  126. package/.output/server/node_modules/@iconify/utils/lib/css/common.mjs +90 -0
  127. package/.output/server/node_modules/@iconify/utils/lib/css/format.mjs +38 -0
  128. package/.output/server/node_modules/@iconify/utils/lib/css/icon.mjs +76 -0
  129. package/.output/server/node_modules/@iconify/utils/lib/css/icons.mjs +168 -0
  130. package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.mjs +22 -0
  131. package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.mjs +14 -0
  132. package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.mjs +16 -0
  133. package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.mjs +22 -0
  134. package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.mjs +33 -0
  135. package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.mjs +51 -0
  136. package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.mjs +84 -0
  137. package/.output/server/node_modules/@iconify/utils/lib/emoji/data.mjs +16 -0
  138. package/.output/server/node_modules/@iconify/utils/lib/emoji/format.mjs +44 -0
  139. package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.mjs +58 -0
  140. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.mjs +231 -0
  141. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.mjs +31 -0
  142. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.mjs +164 -0
  143. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.mjs +216 -0
  144. package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.mjs +113 -0
  145. package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.mjs +104 -0
  146. package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.mjs +34 -0
  147. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.mjs +75 -0
  148. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.mjs +97 -0
  149. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.mjs +54 -0
  150. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.mjs +97 -0
  151. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.mjs +45 -0
  152. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.mjs +105 -0
  153. package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.mjs +54 -0
  154. package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.mjs +24 -0
  155. package/.output/server/node_modules/@iconify/utils/lib/icon/merge.mjs +20 -0
  156. package/.output/server/node_modules/@iconify/utils/lib/icon/name.mjs +53 -0
  157. package/.output/server/node_modules/@iconify/utils/lib/icon/square.mjs +23 -0
  158. package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.mjs +16 -0
  159. package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.mjs +182 -0
  160. package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.mjs +22 -0
  161. package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.mjs +28 -0
  162. package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.mjs +46 -0
  163. package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.mjs +66 -0
  164. package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.mjs +51 -0
  165. package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.mjs +23 -0
  166. package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.mjs +62 -0
  167. package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.mjs +161 -0
  168. package/.output/server/node_modules/@iconify/utils/lib/index.mjs +64 -0
  169. package/.output/server/node_modules/@iconify/utils/lib/loader/custom.mjs +50 -0
  170. package/.output/server/node_modules/@iconify/utils/lib/loader/loader.mjs +59 -0
  171. package/.output/server/node_modules/@iconify/utils/lib/loader/modern.mjs +80 -0
  172. package/.output/server/node_modules/@iconify/utils/lib/loader/utils.mjs +92 -0
  173. package/.output/server/node_modules/@iconify/utils/lib/misc/objects.mjs +30 -0
  174. package/.output/server/node_modules/@iconify/utils/lib/misc/strings.mjs +17 -0
  175. package/.output/server/node_modules/@iconify/utils/lib/misc/title.mjs +5 -0
  176. package/.output/server/node_modules/@iconify/utils/lib/svg/build.mjs +119 -0
  177. package/.output/server/node_modules/@iconify/utils/lib/svg/defs.mjs +30 -0
  178. package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.mjs +20 -0
  179. package/.output/server/node_modules/@iconify/utils/lib/svg/html.mjs +9 -0
  180. package/.output/server/node_modules/@iconify/utils/lib/svg/id.mjs +28 -0
  181. package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.mjs +19 -0
  182. package/.output/server/node_modules/@iconify/utils/lib/svg/parse.mjs +83 -0
  183. package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.mjs +70 -0
  184. package/.output/server/node_modules/@iconify/utils/lib/svg/size.mjs +40 -0
  185. package/.output/server/node_modules/@iconify/utils/lib/svg/trim.mjs +5 -0
  186. package/.output/server/node_modules/@iconify/utils/lib/svg/url.mjs +11 -0
  187. package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.mjs +8 -0
  188. package/.output/server/node_modules/@iconify/utils/package.json +447 -0
  189. package/.output/server/node_modules/@ioredis/commands/built/commands.json +2447 -0
  190. package/.output/server/node_modules/@ioredis/commands/built/index.js +208 -0
  191. package/.output/server/node_modules/@ioredis/commands/package.json +52 -0
  192. package/.output/server/node_modules/@opentelemetry/api/build/src/api/context.js +81 -0
  193. package/.output/server/node_modules/@opentelemetry/api/build/src/api/diag.js +93 -0
  194. package/.output/server/node_modules/@opentelemetry/api/build/src/api/metrics.js +61 -0
  195. package/.output/server/node_modules/@opentelemetry/api/build/src/api/propagation.js +89 -0
  196. package/.output/server/node_modules/@opentelemetry/api/build/src/api/trace.js +79 -0
  197. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/context-helpers.js +63 -0
  198. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/internal/baggage-impl.js +55 -0
  199. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/internal/symbol.js +23 -0
  200. package/.output/server/node_modules/@opentelemetry/api/build/src/baggage/utils.js +51 -0
  201. package/.output/server/node_modules/@opentelemetry/api/build/src/context/NoopContextManager.js +38 -0
  202. package/.output/server/node_modules/@opentelemetry/api/build/src/context/context.js +55 -0
  203. package/.output/server/node_modules/@opentelemetry/api/build/src/context-api.js +24 -0
  204. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js +59 -0
  205. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js +57 -0
  206. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/internal/logLevelLogger.js +45 -0
  207. package/.output/server/node_modules/@opentelemetry/api/build/src/diag/types.js +44 -0
  208. package/.output/server/node_modules/@opentelemetry/api/build/src/diag-api.js +29 -0
  209. package/.output/server/node_modules/@opentelemetry/api/build/src/index.js +81 -0
  210. package/.output/server/node_modules/@opentelemetry/api/build/src/internal/global-utils.js +64 -0
  211. package/.output/server/node_modules/@opentelemetry/api/build/src/internal/semver.js +122 -0
  212. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/Metric.js +25 -0
  213. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/NoopMeter.js +127 -0
  214. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics/NoopMeterProvider.js +31 -0
  215. package/.output/server/node_modules/@opentelemetry/api/build/src/metrics-api.js +24 -0
  216. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/index.js +29 -0
  217. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js +22 -0
  218. package/.output/server/node_modules/@opentelemetry/api/build/src/platform/node/index.js +29 -0
  219. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation/NoopTextMapPropagator.js +34 -0
  220. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation/TextMapPropagator.js +41 -0
  221. package/.output/server/node_modules/@opentelemetry/api/build/src/propagation-api.js +24 -0
  222. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NonRecordingSpan.js +69 -0
  223. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js +75 -0
  224. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js +32 -0
  225. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js +55 -0
  226. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js +54 -0
  227. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js +42 -0
  228. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/context-utils.js +82 -0
  229. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-impl.js +103 -0
  230. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/tracestate-validators.js +46 -0
  231. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/internal/utils.js +24 -0
  232. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/invalid-span-constants.js +27 -0
  233. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/span_kind.js +46 -0
  234. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/spancontext-utils.js +49 -0
  235. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/status.js +23 -0
  236. package/.output/server/node_modules/@opentelemetry/api/build/src/trace/trace_flags.js +26 -0
  237. package/.output/server/node_modules/@opentelemetry/api/build/src/trace-api.js +24 -0
  238. package/.output/server/node_modules/@opentelemetry/api/build/src/version.js +21 -0
  239. package/.output/server/node_modules/@opentelemetry/api/package.json +113 -0
  240. package/.output/server/node_modules/@sqltools/formatter/lib/core/Formatter.js +234 -0
  241. package/.output/server/node_modules/@sqltools/formatter/lib/core/Indentation.js +42 -0
  242. package/.output/server/node_modules/@sqltools/formatter/lib/core/InlineBlock.js +60 -0
  243. package/.output/server/node_modules/@sqltools/formatter/lib/core/Params.js +21 -0
  244. package/.output/server/node_modules/@sqltools/formatter/lib/core/Tokenizer.js +272 -0
  245. package/.output/server/node_modules/@sqltools/formatter/lib/core/escapeRegExp.js +10 -0
  246. package/.output/server/node_modules/@sqltools/formatter/lib/core/last.js +7 -0
  247. package/.output/server/node_modules/@sqltools/formatter/lib/core/types.js +22 -0
  248. package/.output/server/node_modules/@sqltools/formatter/lib/languages/Db2Formatter.js +585 -0
  249. package/.output/server/node_modules/@sqltools/formatter/lib/languages/N1qlFormatter.js +257 -0
  250. package/.output/server/node_modules/@sqltools/formatter/lib/languages/PlSqlFormatter.js +459 -0
  251. package/.output/server/node_modules/@sqltools/formatter/lib/languages/StandardSqlFormatter.js +369 -0
  252. package/.output/server/node_modules/@sqltools/formatter/lib/languages/utils/abstract.js +23 -0
  253. package/.output/server/node_modules/@sqltools/formatter/lib/sqlFormatter.js +34 -0
  254. package/.output/server/node_modules/@sqltools/formatter/package.json +59 -0
  255. package/.output/server/node_modules/@standard-schema/spec/dist/index.js +0 -0
  256. package/.output/server/node_modules/@standard-schema/spec/package.json +52 -0
  257. package/.output/server/node_modules/@vercel/oidc/dist/auth-config.js +84 -0
  258. package/.output/server/node_modules/@vercel/oidc/dist/get-context.js +34 -0
  259. package/.output/server/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js +80 -0
  260. package/.output/server/node_modules/@vercel/oidc/dist/index.js +33 -0
  261. package/.output/server/node_modules/@vercel/oidc/dist/oauth.js +88 -0
  262. package/.output/server/node_modules/@vercel/oidc/dist/token-error.js +40 -0
  263. package/.output/server/node_modules/@vercel/oidc/dist/token-io.js +78 -0
  264. package/.output/server/node_modules/@vercel/oidc/dist/token-util.js +198 -0
  265. package/.output/server/node_modules/@vercel/oidc/dist/token.js +53 -0
  266. package/.output/server/node_modules/@vercel/oidc/package.json +52 -0
  267. package/.output/server/node_modules/@vue/compiler-core/dist/compiler-core.cjs.prod.js +6690 -0
  268. package/.output/server/node_modules/@vue/compiler-core/package.json +58 -0
  269. package/.output/server/node_modules/@vue/compiler-dom/dist/compiler-dom.cjs.prod.js +686 -0
  270. package/.output/server/node_modules/@vue/compiler-dom/package.json +57 -0
  271. package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +1404 -0
  272. package/.output/server/node_modules/@vue/compiler-ssr/package.json +34 -0
  273. package/.output/server/node_modules/@vue/reactivity/dist/reactivity.cjs.prod.js +1789 -0
  274. package/.output/server/node_modules/@vue/reactivity/package.json +55 -0
  275. package/.output/server/node_modules/@vue/runtime-core/dist/runtime-core.cjs.prod.js +6654 -0
  276. package/.output/server/node_modules/@vue/runtime-core/package.json +52 -0
  277. package/.output/server/node_modules/@vue/runtime-dom/dist/runtime-dom.cjs.prod.js +1669 -0
  278. package/.output/server/node_modules/@vue/runtime-dom/package.json +60 -0
  279. package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +857 -0
  280. package/.output/server/node_modules/@vue/server-renderer/package.json +55 -0
  281. package/.output/server/node_modules/@vue/shared/dist/shared.cjs.prod.js +594 -0
  282. package/.output/server/node_modules/@vue/shared/package.json +47 -0
  283. package/.output/server/node_modules/ai/dist/index.mjs +12363 -0
  284. package/.output/server/node_modules/ai/package.json +106 -0
  285. package/.output/server/node_modules/ansis/index.js +1 -0
  286. package/.output/server/node_modules/ansis/package.json +28 -0
  287. package/.output/server/node_modules/app-root-path/index.js +4 -0
  288. package/.output/server/node_modules/app-root-path/lib/app-root-path.js +30 -0
  289. package/.output/server/node_modules/app-root-path/lib/resolve.js +128 -0
  290. package/.output/server/node_modules/app-root-path/package.json +66 -0
  291. package/.output/server/node_modules/balanced-match/index.js +62 -0
  292. package/.output/server/node_modules/balanced-match/package.json +48 -0
  293. package/.output/server/node_modules/bindings/bindings.js +221 -0
  294. package/.output/server/node_modules/bindings/package.json +28 -0
  295. package/.output/server/node_modules/brace-expansion/index.js +203 -0
  296. package/.output/server/node_modules/brace-expansion/package.json +46 -0
  297. package/.output/server/node_modules/cluster-key-slot/lib/index.js +166 -0
  298. package/.output/server/node_modules/cluster-key-slot/package.json +56 -0
  299. package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
  300. package/.output/server/node_modules/consola/dist/core.mjs +512 -0
  301. package/.output/server/node_modules/consola/dist/index.mjs +651 -0
  302. package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
  303. package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
  304. package/.output/server/node_modules/consola/package.json +136 -0
  305. package/.output/server/node_modules/dayjs/dayjs.min.js +1 -0
  306. package/.output/server/node_modules/dayjs/package.json +84 -0
  307. package/.output/server/node_modules/debug/package.json +65 -0
  308. package/.output/server/node_modules/debug/src/browser.js +272 -0
  309. package/.output/server/node_modules/debug/src/common.js +292 -0
  310. package/.output/server/node_modules/debug/src/index.js +10 -0
  311. package/.output/server/node_modules/debug/src/node.js +263 -0
  312. package/.output/server/node_modules/dedent/dist/dedent.js +73 -0
  313. package/.output/server/node_modules/dedent/package.json +119 -0
  314. package/.output/server/node_modules/denque/index.js +481 -0
  315. package/.output/server/node_modules/denque/package.json +58 -0
  316. package/.output/server/node_modules/devalue/index.js +3 -0
  317. package/.output/server/node_modules/devalue/package.json +34 -0
  318. package/.output/server/node_modules/devalue/src/base64.js +110 -0
  319. package/.output/server/node_modules/devalue/src/constants.js +6 -0
  320. package/.output/server/node_modules/devalue/src/parse.js +160 -0
  321. package/.output/server/node_modules/devalue/src/stringify.js +232 -0
  322. package/.output/server/node_modules/devalue/src/uneval.js +351 -0
  323. package/.output/server/node_modules/devalue/src/utils.js +113 -0
  324. package/.output/server/node_modules/dotenv/lib/main.js +361 -0
  325. package/.output/server/node_modules/dotenv/package.json +61 -0
  326. package/.output/server/node_modules/entities/lib/decode.js +536 -0
  327. package/.output/server/node_modules/entities/lib/decode_codepoint.js +76 -0
  328. package/.output/server/node_modules/entities/lib/generated/decode-data-html.js +9 -0
  329. package/.output/server/node_modules/entities/lib/generated/decode-data-xml.js +9 -0
  330. package/.output/server/node_modules/entities/package.json +90 -0
  331. package/.output/server/node_modules/estree-walker/dist/umd/estree-walker.js +344 -0
  332. package/.output/server/node_modules/estree-walker/package.json +37 -0
  333. package/.output/server/node_modules/eventsource-parser/dist/index.js +106 -0
  334. package/.output/server/node_modules/eventsource-parser/dist/stream.js +29 -0
  335. package/.output/server/node_modules/eventsource-parser/package.json +115 -0
  336. package/.output/server/node_modules/file-uri-to-path/index.js +66 -0
  337. package/.output/server/node_modules/file-uri-to-path/package.json +32 -0
  338. package/.output/server/node_modules/glob/dist/commonjs/glob.js +247 -0
  339. package/.output/server/node_modules/glob/dist/commonjs/has-magic.js +27 -0
  340. package/.output/server/node_modules/glob/dist/commonjs/ignore.js +119 -0
  341. package/.output/server/node_modules/glob/dist/commonjs/index.js +68 -0
  342. package/.output/server/node_modules/glob/dist/commonjs/package.json +3 -0
  343. package/.output/server/node_modules/glob/dist/commonjs/pattern.js +219 -0
  344. package/.output/server/node_modules/glob/dist/commonjs/processor.js +301 -0
  345. package/.output/server/node_modules/glob/dist/commonjs/walker.js +387 -0
  346. package/.output/server/node_modules/glob/package.json +99 -0
  347. package/.output/server/node_modules/has-flag/index.js +8 -0
  348. package/.output/server/node_modules/has-flag/package.json +46 -0
  349. package/.output/server/node_modules/hookable/dist/index.mjs +290 -0
  350. package/.output/server/node_modules/hookable/package.json +49 -0
  351. package/.output/server/node_modules/inherits/inherits.js +9 -0
  352. package/.output/server/node_modules/inherits/inherits_browser.js +27 -0
  353. package/.output/server/node_modules/inherits/package.json +29 -0
  354. package/.output/server/node_modules/ioredis/built/Command.js +349 -0
  355. package/.output/server/node_modules/ioredis/built/DataHandler.js +220 -0
  356. package/.output/server/node_modules/ioredis/built/Pipeline.js +334 -0
  357. package/.output/server/node_modules/ioredis/built/Redis.js +697 -0
  358. package/.output/server/node_modules/ioredis/built/ScanStream.js +51 -0
  359. package/.output/server/node_modules/ioredis/built/Script.js +62 -0
  360. package/.output/server/node_modules/ioredis/built/SubscriptionSet.js +41 -0
  361. package/.output/server/node_modules/ioredis/built/autoPipelining.js +159 -0
  362. package/.output/server/node_modules/ioredis/built/cluster/ClusterOptions.js +22 -0
  363. package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriber.js +202 -0
  364. package/.output/server/node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js +224 -0
  365. package/.output/server/node_modules/ioredis/built/cluster/ConnectionPool.js +154 -0
  366. package/.output/server/node_modules/ioredis/built/cluster/DelayQueue.js +53 -0
  367. package/.output/server/node_modules/ioredis/built/cluster/index.js +862 -0
  368. package/.output/server/node_modules/ioredis/built/cluster/util.js +100 -0
  369. package/.output/server/node_modules/ioredis/built/connectors/AbstractConnector.js +26 -0
  370. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js +45 -0
  371. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js +37 -0
  372. package/.output/server/node_modules/ioredis/built/connectors/SentinelConnector/index.js +305 -0
  373. package/.output/server/node_modules/ioredis/built/connectors/StandaloneConnector.js +69 -0
  374. package/.output/server/node_modules/ioredis/built/connectors/index.js +7 -0
  375. package/.output/server/node_modules/ioredis/built/constants/TLSProfiles.js +149 -0
  376. package/.output/server/node_modules/ioredis/built/errors/ClusterAllFailedError.js +15 -0
  377. package/.output/server/node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js +14 -0
  378. package/.output/server/node_modules/ioredis/built/errors/index.js +5 -0
  379. package/.output/server/node_modules/ioredis/built/index.js +62 -0
  380. package/.output/server/node_modules/ioredis/built/redis/RedisOptions.js +55 -0
  381. package/.output/server/node_modules/ioredis/built/redis/event_handler.js +292 -0
  382. package/.output/server/node_modules/ioredis/built/transaction.js +93 -0
  383. package/.output/server/node_modules/ioredis/built/utils/Commander.js +117 -0
  384. package/.output/server/node_modules/ioredis/built/utils/applyMixin.js +8 -0
  385. package/.output/server/node_modules/ioredis/built/utils/debug.js +95 -0
  386. package/.output/server/node_modules/ioredis/built/utils/index.js +297 -0
  387. package/.output/server/node_modules/ioredis/built/utils/lodash.js +9 -0
  388. package/.output/server/node_modules/ioredis/package.json +100 -0
  389. package/.output/server/node_modules/lodash.defaults/index.js +668 -0
  390. package/.output/server/node_modules/lodash.defaults/package.json +19 -0
  391. package/.output/server/node_modules/lodash.isarguments/index.js +229 -0
  392. package/.output/server/node_modules/lodash.isarguments/package.json +19 -0
  393. package/.output/server/node_modules/lru-cache/dist/commonjs/index.js +1546 -0
  394. package/.output/server/node_modules/lru-cache/dist/commonjs/package.json +3 -0
  395. package/.output/server/node_modules/lru-cache/package.json +116 -0
  396. package/.output/server/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  397. package/.output/server/node_modules/minimatch/dist/commonjs/ast.js +592 -0
  398. package/.output/server/node_modules/minimatch/dist/commonjs/brace-expressions.js +152 -0
  399. package/.output/server/node_modules/minimatch/dist/commonjs/escape.js +22 -0
  400. package/.output/server/node_modules/minimatch/dist/commonjs/index.js +1017 -0
  401. package/.output/server/node_modules/minimatch/dist/commonjs/package.json +3 -0
  402. package/.output/server/node_modules/minimatch/dist/commonjs/unescape.js +24 -0
  403. package/.output/server/node_modules/minimatch/package.json +82 -0
  404. package/.output/server/node_modules/minipass/dist/commonjs/index.js +1028 -0
  405. package/.output/server/node_modules/minipass/dist/commonjs/package.json +3 -0
  406. package/.output/server/node_modules/minipass/package.json +82 -0
  407. package/.output/server/node_modules/ms/index.js +162 -0
  408. package/.output/server/node_modules/ms/package.json +38 -0
  409. package/.output/server/node_modules/path-scurry/dist/commonjs/index.js +2014 -0
  410. package/.output/server/node_modules/path-scurry/dist/commonjs/package.json +3 -0
  411. package/.output/server/node_modules/path-scurry/package.json +89 -0
  412. package/.output/server/node_modules/pg/lib/client.js +650 -0
  413. package/.output/server/node_modules/pg/lib/connection-parameters.js +167 -0
  414. package/.output/server/node_modules/pg/lib/connection.js +222 -0
  415. package/.output/server/node_modules/pg/lib/crypto/cert-signatures.js +121 -0
  416. package/.output/server/node_modules/pg/lib/crypto/sasl.js +212 -0
  417. package/.output/server/node_modules/pg/lib/crypto/utils-legacy.js +43 -0
  418. package/.output/server/node_modules/pg/lib/crypto/utils-webcrypto.js +88 -0
  419. package/.output/server/node_modules/pg/lib/crypto/utils.js +9 -0
  420. package/.output/server/node_modules/pg/lib/defaults.js +84 -0
  421. package/.output/server/node_modules/pg/lib/index.js +58 -0
  422. package/.output/server/node_modules/pg/lib/native/client.js +307 -0
  423. package/.output/server/node_modules/pg/lib/native/index.js +2 -0
  424. package/.output/server/node_modules/pg/lib/native/query.js +168 -0
  425. package/.output/server/node_modules/pg/lib/query.js +253 -0
  426. package/.output/server/node_modules/pg/lib/result.js +108 -0
  427. package/.output/server/node_modules/pg/lib/stream.js +81 -0
  428. package/.output/server/node_modules/pg/lib/type-overrides.js +35 -0
  429. package/.output/server/node_modules/pg/lib/utils.js +206 -0
  430. package/.output/server/node_modules/pg/package.json +62 -0
  431. package/.output/server/node_modules/pg-cloudflare/dist/empty.js +4 -0
  432. package/.output/server/node_modules/pg-cloudflare/package.json +32 -0
  433. package/.output/server/node_modules/pg-connection-string/index.js +112 -0
  434. package/.output/server/node_modules/pg-connection-string/package.json +40 -0
  435. package/.output/server/node_modules/pg-cursor/index.js +265 -0
  436. package/.output/server/node_modules/pg-cursor/package.json +38 -0
  437. package/.output/server/node_modules/pg-int8/index.js +100 -0
  438. package/.output/server/node_modules/pg-int8/package.json +24 -0
  439. package/.output/server/node_modules/pg-pool/index.js +471 -0
  440. package/.output/server/node_modules/pg-pool/package.json +41 -0
  441. package/.output/server/node_modules/pg-protocol/dist/buffer-reader.js +55 -0
  442. package/.output/server/node_modules/pg-protocol/dist/buffer-writer.js +81 -0
  443. package/.output/server/node_modules/pg-protocol/dist/index.js +15 -0
  444. package/.output/server/node_modules/pg-protocol/dist/messages.js +160 -0
  445. package/.output/server/node_modules/pg-protocol/dist/parser.js +304 -0
  446. package/.output/server/node_modules/pg-protocol/dist/serializer.js +189 -0
  447. package/.output/server/node_modules/pg-protocol/package.json +35 -0
  448. package/.output/server/node_modules/pg-query-stream/dist/index.js +48 -0
  449. package/.output/server/node_modules/pg-query-stream/package.json +60 -0
  450. package/.output/server/node_modules/pg-types/index.js +47 -0
  451. package/.output/server/node_modules/pg-types/lib/arrayParser.js +11 -0
  452. package/.output/server/node_modules/pg-types/lib/binaryParsers.js +257 -0
  453. package/.output/server/node_modules/pg-types/lib/builtins.js +73 -0
  454. package/.output/server/node_modules/pg-types/lib/textParsers.js +215 -0
  455. package/.output/server/node_modules/pg-types/package.json +42 -0
  456. package/.output/server/node_modules/pgpass/lib/helper.js +233 -0
  457. package/.output/server/node_modules/pgpass/lib/index.js +23 -0
  458. package/.output/server/node_modules/pgpass/package.json +41 -0
  459. package/.output/server/node_modules/postgres-array/index.js +97 -0
  460. package/.output/server/node_modules/postgres-array/package.json +35 -0
  461. package/.output/server/node_modules/postgres-bytea/index.js +31 -0
  462. package/.output/server/node_modules/postgres-bytea/package.json +34 -0
  463. package/.output/server/node_modules/postgres-date/index.js +116 -0
  464. package/.output/server/node_modules/postgres-date/package.json +33 -0
  465. package/.output/server/node_modules/postgres-interval/index.js +125 -0
  466. package/.output/server/node_modules/postgres-interval/package.json +36 -0
  467. package/.output/server/node_modules/redis-errors/index.js +7 -0
  468. package/.output/server/node_modules/redis-errors/lib/modern.js +59 -0
  469. package/.output/server/node_modules/redis-errors/lib/old.js +119 -0
  470. package/.output/server/node_modules/redis-errors/package.json +41 -0
  471. package/.output/server/node_modules/redis-parser/index.js +3 -0
  472. package/.output/server/node_modules/redis-parser/lib/parser.js +552 -0
  473. package/.output/server/node_modules/redis-parser/package.json +53 -0
  474. package/.output/server/node_modules/reflect-metadata/Reflect.js +1415 -0
  475. package/.output/server/node_modules/reflect-metadata/package.json +68 -0
  476. package/.output/server/node_modules/safe-buffer/index.js +65 -0
  477. package/.output/server/node_modules/safe-buffer/package.json +51 -0
  478. package/.output/server/node_modules/sha.js/hash.js +81 -0
  479. package/.output/server/node_modules/sha.js/index.js +15 -0
  480. package/.output/server/node_modules/sha.js/package.json +30 -0
  481. package/.output/server/node_modules/sha.js/sha.js +94 -0
  482. package/.output/server/node_modules/sha.js/sha1.js +99 -0
  483. package/.output/server/node_modules/sha.js/sha224.js +53 -0
  484. package/.output/server/node_modules/sha.js/sha256.js +135 -0
  485. package/.output/server/node_modules/sha.js/sha384.js +57 -0
  486. package/.output/server/node_modules/sha.js/sha512.js +260 -0
  487. package/.output/server/node_modules/source-map-js/lib/array-set.js +121 -0
  488. package/.output/server/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  489. package/.output/server/node_modules/source-map-js/lib/base64.js +67 -0
  490. package/.output/server/node_modules/source-map-js/lib/binary-search.js +111 -0
  491. package/.output/server/node_modules/source-map-js/lib/mapping-list.js +79 -0
  492. package/.output/server/node_modules/source-map-js/lib/quick-sort.js +132 -0
  493. package/.output/server/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  494. package/.output/server/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  495. package/.output/server/node_modules/source-map-js/lib/source-node.js +413 -0
  496. package/.output/server/node_modules/source-map-js/lib/util.js +594 -0
  497. package/.output/server/node_modules/source-map-js/package.json +71 -0
  498. package/.output/server/node_modules/source-map-js/source-map.js +8 -0
  499. package/.output/server/node_modules/split2/index.js +141 -0
  500. package/.output/server/node_modules/split2/package.json +39 -0
  501. package/.output/server/node_modules/sql-highlight/lib/escapeHtml.js +59 -0
  502. package/.output/server/node_modules/sql-highlight/lib/index.js +85 -0
  503. package/.output/server/node_modules/sql-highlight/lib/keywords.js +145 -0
  504. package/.output/server/node_modules/sql-highlight/package.json +49 -0
  505. package/.output/server/node_modules/sqlite3/build/Release/node_sqlite3.node +0 -0
  506. package/.output/server/node_modules/sqlite3/build/Release/node_sqlite3.node.bak +0 -0
  507. package/.output/server/node_modules/sqlite3/lib/sqlite3-binding.js +1 -0
  508. package/.output/server/node_modules/sqlite3/lib/sqlite3.js +207 -0
  509. package/.output/server/node_modules/sqlite3/lib/trace.js +38 -0
  510. package/.output/server/node_modules/sqlite3/package.json +89 -0
  511. package/.output/server/node_modules/standard-as-callback/built/index.js +41 -0
  512. package/.output/server/node_modules/standard-as-callback/built/utils.js +23 -0
  513. package/.output/server/node_modules/standard-as-callback/package.json +40 -0
  514. package/.output/server/node_modules/supports-color/index.js +152 -0
  515. package/.output/server/node_modules/supports-color/package.json +58 -0
  516. package/.output/server/node_modules/tslib/package.json +47 -0
  517. package/.output/server/node_modules/tslib/tslib.js +484 -0
  518. package/.output/server/node_modules/typeorm/cache/DbQueryResultCache.js +264 -0
  519. package/.output/server/node_modules/typeorm/cache/QueryResultCacheFactory.js +42 -0
  520. package/.output/server/node_modules/typeorm/cache/RedisQueryResultCache.js +197 -0
  521. package/.output/server/node_modules/typeorm/common/DeepPartial.js +4 -0
  522. package/.output/server/node_modules/typeorm/common/EntityTarget.js +4 -0
  523. package/.output/server/node_modules/typeorm/common/MixedList.js +4 -0
  524. package/.output/server/node_modules/typeorm/common/ObjectLiteral.js +4 -0
  525. package/.output/server/node_modules/typeorm/common/ObjectType.js +4 -0
  526. package/.output/server/node_modules/typeorm/common/RelationType.js +4 -0
  527. package/.output/server/node_modules/typeorm/connection/Connection.js +16 -0
  528. package/.output/server/node_modules/typeorm/connection/ConnectionManager.js +66 -0
  529. package/.output/server/node_modules/typeorm/connection/ConnectionMetadataBuilder.js +74 -0
  530. package/.output/server/node_modules/typeorm/connection/ConnectionOptionsReader.js +198 -0
  531. package/.output/server/node_modules/typeorm/connection/options-reader/ConnectionOptionsEnvReader.js +111 -0
  532. package/.output/server/node_modules/typeorm/container.js +60 -0
  533. package/.output/server/node_modules/typeorm/data-source/DataSource.js +517 -0
  534. package/.output/server/node_modules/typeorm/decorator/Check.js +27 -0
  535. package/.output/server/node_modules/typeorm/decorator/EntityRepository.js +21 -0
  536. package/.output/server/node_modules/typeorm/decorator/Exclusion.js +27 -0
  537. package/.output/server/node_modules/typeorm/decorator/ForeignKey.js +44 -0
  538. package/.output/server/node_modules/typeorm/decorator/Generated.js +24 -0
  539. package/.output/server/node_modules/typeorm/decorator/Index.js +56 -0
  540. package/.output/server/node_modules/typeorm/decorator/Unique.js +50 -0
  541. package/.output/server/node_modules/typeorm/decorator/columns/Column.js +78 -0
  542. package/.output/server/node_modules/typeorm/decorator/columns/CreateDateColumn.js +21 -0
  543. package/.output/server/node_modules/typeorm/decorator/columns/DeleteDateColumn.js +20 -0
  544. package/.output/server/node_modules/typeorm/decorator/columns/ObjectIdColumn.js +27 -0
  545. package/.output/server/node_modules/typeorm/decorator/columns/PrimaryColumn.js +63 -0
  546. package/.output/server/node_modules/typeorm/decorator/columns/PrimaryGeneratedColumn.js +59 -0
  547. package/.output/server/node_modules/typeorm/decorator/columns/UpdateDateColumn.js +20 -0
  548. package/.output/server/node_modules/typeorm/decorator/columns/VersionColumn.js +21 -0
  549. package/.output/server/node_modules/typeorm/decorator/columns/ViewColumn.js +19 -0
  550. package/.output/server/node_modules/typeorm/decorator/columns/VirtualColumn.js +49 -0
  551. package/.output/server/node_modules/typeorm/decorator/entity/ChildEntity.js +25 -0
  552. package/.output/server/node_modules/typeorm/decorator/entity/Entity.js +31 -0
  553. package/.output/server/node_modules/typeorm/decorator/entity/TableInheritance.js +22 -0
  554. package/.output/server/node_modules/typeorm/decorator/entity-view/ViewEntity.js +32 -0
  555. package/.output/server/node_modules/typeorm/decorator/listeners/AfterInsert.js +19 -0
  556. package/.output/server/node_modules/typeorm/decorator/listeners/AfterLoad.js +19 -0
  557. package/.output/server/node_modules/typeorm/decorator/listeners/AfterRecover.js +19 -0
  558. package/.output/server/node_modules/typeorm/decorator/listeners/AfterRemove.js +19 -0
  559. package/.output/server/node_modules/typeorm/decorator/listeners/AfterSoftRemove.js +19 -0
  560. package/.output/server/node_modules/typeorm/decorator/listeners/AfterUpdate.js +19 -0
  561. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeInsert.js +19 -0
  562. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRecover.js +19 -0
  563. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeRemove.js +19 -0
  564. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeSoftRemove.js +19 -0
  565. package/.output/server/node_modules/typeorm/decorator/listeners/BeforeUpdate.js +19 -0
  566. package/.output/server/node_modules/typeorm/decorator/listeners/EventSubscriber.js +17 -0
  567. package/.output/server/node_modules/typeorm/decorator/options/ColumnOptions.js +4 -0
  568. package/.output/server/node_modules/typeorm/decorator/options/EntityOptions.js +4 -0
  569. package/.output/server/node_modules/typeorm/decorator/options/IndexOptions.js +4 -0
  570. package/.output/server/node_modules/typeorm/decorator/options/JoinColumnOptions.js +4 -0
  571. package/.output/server/node_modules/typeorm/decorator/options/JoinTableOptions.js +4 -0
  572. package/.output/server/node_modules/typeorm/decorator/options/RelationOptions.js +4 -0
  573. package/.output/server/node_modules/typeorm/decorator/options/ValueTransformer.js +4 -0
  574. package/.output/server/node_modules/typeorm/decorator/relations/JoinColumn.js +27 -0
  575. package/.output/server/node_modules/typeorm/decorator/relations/JoinTable.js +34 -0
  576. package/.output/server/node_modules/typeorm/decorator/relations/ManyToMany.js +46 -0
  577. package/.output/server/node_modules/typeorm/decorator/relations/ManyToOne.js +46 -0
  578. package/.output/server/node_modules/typeorm/decorator/relations/OneToMany.js +37 -0
  579. package/.output/server/node_modules/typeorm/decorator/relations/OneToOne.js +45 -0
  580. package/.output/server/node_modules/typeorm/decorator/relations/RelationCount.js +23 -0
  581. package/.output/server/node_modules/typeorm/decorator/relations/RelationId.js +22 -0
  582. package/.output/server/node_modules/typeorm/decorator/tree/Tree.js +21 -0
  583. package/.output/server/node_modules/typeorm/decorator/tree/TreeChildren.js +34 -0
  584. package/.output/server/node_modules/typeorm/decorator/tree/TreeLevelColumn.js +19 -0
  585. package/.output/server/node_modules/typeorm/decorator/tree/TreeParent.js +33 -0
  586. package/.output/server/node_modules/typeorm/driver/DriverFactory.js +98 -0
  587. package/.output/server/node_modules/typeorm/driver/DriverUtils.js +228 -0
  588. package/.output/server/node_modules/typeorm/driver/Query.js +16 -0
  589. package/.output/server/node_modules/typeorm/driver/SqlInMemory.js +15 -0
  590. package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlDriver.js +847 -0
  591. package/.output/server/node_modules/typeorm/driver/aurora-mysql/AuroraMysqlQueryRunner.js +1709 -0
  592. package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresDriver.js +103 -0
  593. package/.output/server/node_modules/typeorm/driver/aurora-postgres/AuroraPostgresQueryRunner.js +146 -0
  594. package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3Driver.js +153 -0
  595. package/.output/server/node_modules/typeorm/driver/better-sqlite3/BetterSqlite3QueryRunner.js +126 -0
  596. package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorDriver.js +78 -0
  597. package/.output/server/node_modules/typeorm/driver/capacitor/CapacitorQueryRunner.js +98 -0
  598. package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachDriver.js +885 -0
  599. package/.output/server/node_modules/typeorm/driver/cockroachdb/CockroachQueryRunner.js +2453 -0
  600. package/.output/server/node_modules/typeorm/driver/cordova/CordovaDriver.js +76 -0
  601. package/.output/server/node_modules/typeorm/driver/cordova/CordovaQueryRunner.js +170 -0
  602. package/.output/server/node_modules/typeorm/driver/expo/ExpoDriver.js +29 -0
  603. package/.output/server/node_modules/typeorm/driver/expo/ExpoDriverFactory.js +22 -0
  604. package/.output/server/node_modules/typeorm/driver/expo/ExpoQueryRunner.js +65 -0
  605. package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyDriver.js +75 -0
  606. package/.output/server/node_modules/typeorm/driver/expo/legacy/ExpoLegacyQueryRunner.js +169 -0
  607. package/.output/server/node_modules/typeorm/driver/mongodb/MongoDriver.js +404 -0
  608. package/.output/server/node_modules/typeorm/driver/mongodb/MongoQueryRunner.js +701 -0
  609. package/.output/server/node_modules/typeorm/driver/mongodb/bson.typings.js +5 -0
  610. package/.output/server/node_modules/typeorm/driver/mongodb/typings.js +23 -0
  611. package/.output/server/node_modules/typeorm/driver/mysql/MysqlDriver.js +1105 -0
  612. package/.output/server/node_modules/typeorm/driver/mysql/MysqlQueryRunner.js +2139 -0
  613. package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptDriver.js +94 -0
  614. package/.output/server/node_modules/typeorm/driver/nativescript/NativescriptQueryRunner.js +92 -0
  615. package/.output/server/node_modules/typeorm/driver/oracle/OracleDriver.js +869 -0
  616. package/.output/server/node_modules/typeorm/driver/oracle/OracleQueryRunner.js +1884 -0
  617. package/.output/server/node_modules/typeorm/driver/postgres/PostgresDriver.js +1259 -0
  618. package/.output/server/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js +2729 -0
  619. package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeDriver.js +728 -0
  620. package/.output/server/node_modules/typeorm/driver/react-native/ReactNativeQueryRunner.js +107 -0
  621. package/.output/server/node_modules/typeorm/driver/sap/SapDriver.js +681 -0
  622. package/.output/server/node_modules/typeorm/driver/sap/SapQueryRunner.js +2054 -0
  623. package/.output/server/node_modules/typeorm/driver/spanner/SpannerDriver.js +613 -0
  624. package/.output/server/node_modules/typeorm/driver/spanner/SpannerQueryRunner.js +1464 -0
  625. package/.output/server/node_modules/typeorm/driver/sqlite/SqliteDriver.js +174 -0
  626. package/.output/server/node_modules/typeorm/driver/sqlite/SqliteQueryRunner.js +124 -0
  627. package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteDriver.js +695 -0
  628. package/.output/server/node_modules/typeorm/driver/sqlite-abstract/AbstractSqliteQueryRunner.js +1511 -0
  629. package/.output/server/node_modules/typeorm/driver/sqljs/SqljsDriver.js +250 -0
  630. package/.output/server/node_modules/typeorm/driver/sqljs/SqljsQueryRunner.js +123 -0
  631. package/.output/server/node_modules/typeorm/driver/sqlserver/MssqlParameter.js +23 -0
  632. package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerDriver.js +922 -0
  633. package/.output/server/node_modules/typeorm/driver/sqlserver/SqlServerQueryRunner.js +2484 -0
  634. package/.output/server/node_modules/typeorm/driver/types/DatabaseType.js +4 -0
  635. package/.output/server/node_modules/typeorm/driver/types/GeoJsonTypes.js +4 -0
  636. package/.output/server/node_modules/typeorm/driver/types/MetadataTableType.js +11 -0
  637. package/.output/server/node_modules/typeorm/driver/types/ReplicationMode.js +4 -0
  638. package/.output/server/node_modules/typeorm/entity-manager/EntityManager.js +853 -0
  639. package/.output/server/node_modules/typeorm/entity-manager/EntityManagerFactory.js +24 -0
  640. package/.output/server/node_modules/typeorm/entity-manager/MongoEntityManager.js +668 -0
  641. package/.output/server/node_modules/typeorm/entity-manager/SqljsEntityManager.js +44 -0
  642. package/.output/server/node_modules/typeorm/entity-schema/EntitySchema.js +15 -0
  643. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js +8 -0
  644. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaEmbeddedError.js +18 -0
  645. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaOptions.js +11 -0
  646. package/.output/server/node_modules/typeorm/entity-schema/EntitySchemaTransformer.js +333 -0
  647. package/.output/server/node_modules/typeorm/error/AlreadyHasActiveConnectionError.js +16 -0
  648. package/.output/server/node_modules/typeorm/error/CannotAttachTreeChildrenEntityError.js +16 -0
  649. package/.output/server/node_modules/typeorm/error/CannotConnectAlreadyConnectedError.js +15 -0
  650. package/.output/server/node_modules/typeorm/error/CannotCreateEntityIdMapError.js +21 -0
  651. package/.output/server/node_modules/typeorm/error/CannotDetermineEntityError.js +16 -0
  652. package/.output/server/node_modules/typeorm/error/CannotExecuteNotConnectedError.js +15 -0
  653. package/.output/server/node_modules/typeorm/error/CannotGetEntityManagerNotConnectedError.js +15 -0
  654. package/.output/server/node_modules/typeorm/error/CannotReflectMethodParameterTypeError.js +18 -0
  655. package/.output/server/node_modules/typeorm/error/CircularRelationsError.js +16 -0
  656. package/.output/server/node_modules/typeorm/error/ColumnTypeUndefinedError.js +19 -0
  657. package/.output/server/node_modules/typeorm/error/ConnectionIsNotSetError.js +15 -0
  658. package/.output/server/node_modules/typeorm/error/ConnectionNotFoundError.js +15 -0
  659. package/.output/server/node_modules/typeorm/error/CustomRepositoryCannotInheritRepositoryError.js +18 -0
  660. package/.output/server/node_modules/typeorm/error/CustomRepositoryDoesNotHaveEntityError.js +18 -0
  661. package/.output/server/node_modules/typeorm/error/CustomRepositoryNotFoundError.js +18 -0
  662. package/.output/server/node_modules/typeorm/error/DataTypeNotSupportedError.js +14 -0
  663. package/.output/server/node_modules/typeorm/error/DriverOptionNotSetError.js +16 -0
  664. package/.output/server/node_modules/typeorm/error/DriverPackageNotInstalledError.js +16 -0
  665. package/.output/server/node_modules/typeorm/error/EntityMetadataNotFoundError.js +29 -0
  666. package/.output/server/node_modules/typeorm/error/EntityNotFoundError.js +42 -0
  667. package/.output/server/node_modules/typeorm/error/EntityPropertyNotFoundError.js +17 -0
  668. package/.output/server/node_modules/typeorm/error/FindRelationsNotFoundError.js +23 -0
  669. package/.output/server/node_modules/typeorm/error/ForbiddenTransactionModeOverrideError.js +16 -0
  670. package/.output/server/node_modules/typeorm/error/InitializedRelationError.js +20 -0
  671. package/.output/server/node_modules/typeorm/error/InsertValuesMissingError.js +16 -0
  672. package/.output/server/node_modules/typeorm/error/LimitOnUpdateNotSupportedError.js +15 -0
  673. package/.output/server/node_modules/typeorm/error/LockNotSupportedOnGivenDriverError.js +15 -0
  674. package/.output/server/node_modules/typeorm/error/MetadataAlreadyExistsError.js +18 -0
  675. package/.output/server/node_modules/typeorm/error/MetadataWithSuchNameAlreadyExistsError.js +16 -0
  676. package/.output/server/node_modules/typeorm/error/MissingDeleteDateColumnError.js +12 -0
  677. package/.output/server/node_modules/typeorm/error/MissingDriverError.js +16 -0
  678. package/.output/server/node_modules/typeorm/error/MissingJoinColumnError.js +23 -0
  679. package/.output/server/node_modules/typeorm/error/MissingJoinTableError.js +23 -0
  680. package/.output/server/node_modules/typeorm/error/MissingPrimaryColumnError.js +13 -0
  681. package/.output/server/node_modules/typeorm/error/MustBeEntityError.js +15 -0
  682. package/.output/server/node_modules/typeorm/error/NestedSetMultipleRootError.js +12 -0
  683. package/.output/server/node_modules/typeorm/error/NoConnectionForRepositoryError.js +16 -0
  684. package/.output/server/node_modules/typeorm/error/NoConnectionOptionError.js +16 -0
  685. package/.output/server/node_modules/typeorm/error/NoNeedToReleaseEntityManagerError.js +17 -0
  686. package/.output/server/node_modules/typeorm/error/NoVersionOrUpdateDateColumnError.js +15 -0
  687. package/.output/server/node_modules/typeorm/error/OffsetWithoutLimitNotSupportedError.js +17 -0
  688. package/.output/server/node_modules/typeorm/error/OptimisticLockCanNotBeUsedError.js +15 -0
  689. package/.output/server/node_modules/typeorm/error/OptimisticLockVersionMismatchError.js +15 -0
  690. package/.output/server/node_modules/typeorm/error/PersistedEntityNotFoundError.js +15 -0
  691. package/.output/server/node_modules/typeorm/error/PessimisticLockTransactionRequiredError.js +15 -0
  692. package/.output/server/node_modules/typeorm/error/PrimaryColumnCannotBeNullableError.js +13 -0
  693. package/.output/server/node_modules/typeorm/error/QueryFailedError.js +30 -0
  694. package/.output/server/node_modules/typeorm/error/QueryRunnerAlreadyReleasedError.js +12 -0
  695. package/.output/server/node_modules/typeorm/error/QueryRunnerProviderAlreadyReleasedError.js +16 -0
  696. package/.output/server/node_modules/typeorm/error/RepositoryNotTreeError.js +32 -0
  697. package/.output/server/node_modules/typeorm/error/ReturningStatementNotSupportedError.js +16 -0
  698. package/.output/server/node_modules/typeorm/error/SubjectRemovedAndUpdatedError.js +16 -0
  699. package/.output/server/node_modules/typeorm/error/SubjectWithoutIdentifierError.js +17 -0
  700. package/.output/server/node_modules/typeorm/error/TransactionAlreadyStartedError.js +15 -0
  701. package/.output/server/node_modules/typeorm/error/TransactionNotStartedError.js +15 -0
  702. package/.output/server/node_modules/typeorm/error/TreeRepositoryNotSupportedError.js +12 -0
  703. package/.output/server/node_modules/typeorm/error/TypeORMError.js +23 -0
  704. package/.output/server/node_modules/typeorm/error/UpdateValuesMissingError.js +12 -0
  705. package/.output/server/node_modules/typeorm/error/UsingJoinColumnIsNotAllowedError.js +13 -0
  706. package/.output/server/node_modules/typeorm/error/UsingJoinColumnOnlyOnOneSideAllowedError.js +14 -0
  707. package/.output/server/node_modules/typeorm/error/UsingJoinTableIsNotAllowedError.js +14 -0
  708. package/.output/server/node_modules/typeorm/error/UsingJoinTableOnlyOnOneSideAllowedError.js +14 -0
  709. package/.output/server/node_modules/typeorm/error/index.js +66 -0
  710. package/.output/server/node_modules/typeorm/find-options/EqualOperator.js +13 -0
  711. package/.output/server/node_modules/typeorm/find-options/FindManyOptions.js +4 -0
  712. package/.output/server/node_modules/typeorm/find-options/FindOneOptions.js +4 -0
  713. package/.output/server/node_modules/typeorm/find-options/FindOperator.js +96 -0
  714. package/.output/server/node_modules/typeorm/find-options/FindOperatorType.js +4 -0
  715. package/.output/server/node_modules/typeorm/find-options/FindOptionsOrder.js +4 -0
  716. package/.output/server/node_modules/typeorm/find-options/FindOptionsRelations.js +4 -0
  717. package/.output/server/node_modules/typeorm/find-options/FindOptionsSelect.js +4 -0
  718. package/.output/server/node_modules/typeorm/find-options/FindOptionsUtils.js +350 -0
  719. package/.output/server/node_modules/typeorm/find-options/FindOptionsWhere.js +4 -0
  720. package/.output/server/node_modules/typeorm/find-options/FindTreeOptions.js +4 -0
  721. package/.output/server/node_modules/typeorm/find-options/JoinOptions.js +4 -0
  722. package/.output/server/node_modules/typeorm/find-options/OrderByCondition.js +4 -0
  723. package/.output/server/node_modules/typeorm/find-options/operator/And.js +9 -0
  724. package/.output/server/node_modules/typeorm/find-options/operator/Any.js +13 -0
  725. package/.output/server/node_modules/typeorm/find-options/operator/ArrayContainedBy.js +13 -0
  726. package/.output/server/node_modules/typeorm/find-options/operator/ArrayContains.js +13 -0
  727. package/.output/server/node_modules/typeorm/find-options/operator/ArrayOverlap.js +13 -0
  728. package/.output/server/node_modules/typeorm/find-options/operator/Between.js +13 -0
  729. package/.output/server/node_modules/typeorm/find-options/operator/Equal.js +17 -0
  730. package/.output/server/node_modules/typeorm/find-options/operator/ILike.js +13 -0
  731. package/.output/server/node_modules/typeorm/find-options/operator/In.js +13 -0
  732. package/.output/server/node_modules/typeorm/find-options/operator/IsNull.js +13 -0
  733. package/.output/server/node_modules/typeorm/find-options/operator/JsonContains.js +13 -0
  734. package/.output/server/node_modules/typeorm/find-options/operator/LessThan.js +13 -0
  735. package/.output/server/node_modules/typeorm/find-options/operator/LessThanOrEqual.js +13 -0
  736. package/.output/server/node_modules/typeorm/find-options/operator/Like.js +13 -0
  737. package/.output/server/node_modules/typeorm/find-options/operator/MoreThan.js +13 -0
  738. package/.output/server/node_modules/typeorm/find-options/operator/MoreThanOrEqual.js +13 -0
  739. package/.output/server/node_modules/typeorm/find-options/operator/Not.js +14 -0
  740. package/.output/server/node_modules/typeorm/find-options/operator/Or.js +9 -0
  741. package/.output/server/node_modules/typeorm/find-options/operator/Raw.js +12 -0
  742. package/.output/server/node_modules/typeorm/globals.js +182 -0
  743. package/.output/server/node_modules/typeorm/index.js +196 -0
  744. package/.output/server/node_modules/typeorm/index.mjs +422 -0
  745. package/.output/server/node_modules/typeorm/logger/AbstractLogger.js +238 -0
  746. package/.output/server/node_modules/typeorm/logger/AdvancedConsoleLogger.js +56 -0
  747. package/.output/server/node_modules/typeorm/logger/DebugLogger.js +78 -0
  748. package/.output/server/node_modules/typeorm/logger/FileLogger.js +88 -0
  749. package/.output/server/node_modules/typeorm/logger/FormattedConsoleLogger.js +59 -0
  750. package/.output/server/node_modules/typeorm/logger/Logger.js +4 -0
  751. package/.output/server/node_modules/typeorm/logger/LoggerFactory.js +39 -0
  752. package/.output/server/node_modules/typeorm/logger/LoggerOptions.js +4 -0
  753. package/.output/server/node_modules/typeorm/logger/SimpleConsoleLogger.js +57 -0
  754. package/.output/server/node_modules/typeorm/metadata/CheckMetadata.js +35 -0
  755. package/.output/server/node_modules/typeorm/metadata/ColumnMetadata.js +618 -0
  756. package/.output/server/node_modules/typeorm/metadata/EmbeddedMetadata.js +224 -0
  757. package/.output/server/node_modules/typeorm/metadata/EntityListenerMetadata.js +77 -0
  758. package/.output/server/node_modules/typeorm/metadata/EntityMetadata.js +692 -0
  759. package/.output/server/node_modules/typeorm/metadata/ExclusionMetadata.js +35 -0
  760. package/.output/server/node_modules/typeorm/metadata/ForeignKeyMetadata.js +57 -0
  761. package/.output/server/node_modules/typeorm/metadata/IndexMetadata.js +144 -0
  762. package/.output/server/node_modules/typeorm/metadata/RelationCountMetadata.js +39 -0
  763. package/.output/server/node_modules/typeorm/metadata/RelationIdMetadata.js +62 -0
  764. package/.output/server/node_modules/typeorm/metadata/RelationMetadata.js +440 -0
  765. package/.output/server/node_modules/typeorm/metadata/UniqueMetadata.js +101 -0
  766. package/.output/server/node_modules/typeorm/metadata/types/EventListenerTypes.js +22 -0
  767. package/.output/server/node_modules/typeorm/metadata-args/MetadataArgsStorage.js +236 -0
  768. package/.output/server/node_modules/typeorm/metadata-builder/ClosureJunctionEntityMetadataBuilder.js +145 -0
  769. package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataBuilder.js +838 -0
  770. package/.output/server/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js +258 -0
  771. package/.output/server/node_modules/typeorm/metadata-builder/JunctionEntityMetadataBuilder.js +287 -0
  772. package/.output/server/node_modules/typeorm/metadata-builder/MetadataUtils.js +44 -0
  773. package/.output/server/node_modules/typeorm/metadata-builder/RelationJoinColumnBuilder.js +185 -0
  774. package/.output/server/node_modules/typeorm/migration/Migration.js +21 -0
  775. package/.output/server/node_modules/typeorm/migration/MigrationExecutor.js +534 -0
  776. package/.output/server/node_modules/typeorm/naming-strategy/DefaultNamingStrategy.js +145 -0
  777. package/.output/server/node_modules/typeorm/naming-strategy/LegacyOracleNamingStrategy.js +50 -0
  778. package/.output/server/node_modules/typeorm/package.json +268 -0
  779. package/.output/server/node_modules/typeorm/persistence/EntityPersistExecutor.js +170 -0
  780. package/.output/server/node_modules/typeorm/persistence/Subject.js +239 -0
  781. package/.output/server/node_modules/typeorm/persistence/SubjectChangedColumnsComputer.js +216 -0
  782. package/.output/server/node_modules/typeorm/persistence/SubjectDatabaseEntityLoader.js +135 -0
  783. package/.output/server/node_modules/typeorm/persistence/SubjectExecutor.js +760 -0
  784. package/.output/server/node_modules/typeorm/persistence/SubjectTopologicalSorter.js +174 -0
  785. package/.output/server/node_modules/typeorm/persistence/subject-builder/CascadesSubjectBuilder.js +107 -0
  786. package/.output/server/node_modules/typeorm/persistence/subject-builder/ManyToManySubjectBuilder.js +218 -0
  787. package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToManySubjectBuilder.js +181 -0
  788. package/.output/server/node_modules/typeorm/persistence/subject-builder/OneToOneInverseSideSubjectBuilder.js +155 -0
  789. package/.output/server/node_modules/typeorm/persistence/tree/ClosureSubjectExecutor.js +241 -0
  790. package/.output/server/node_modules/typeorm/persistence/tree/MaterializedPathSubjectExecutor.js +125 -0
  791. package/.output/server/node_modules/typeorm/persistence/tree/NestedSetSubjectExecutor.js +271 -0
  792. package/.output/server/node_modules/typeorm/platform/PlatformTools.js +243 -0
  793. package/.output/server/node_modules/typeorm/query-builder/Alias.js +29 -0
  794. package/.output/server/node_modules/typeorm/query-builder/Brackets.js +19 -0
  795. package/.output/server/node_modules/typeorm/query-builder/DeleteQueryBuilder.js +200 -0
  796. package/.output/server/node_modules/typeorm/query-builder/InsertQueryBuilder.js +745 -0
  797. package/.output/server/node_modules/typeorm/query-builder/JoinAttribute.js +175 -0
  798. package/.output/server/node_modules/typeorm/query-builder/NotBrackets.js +17 -0
  799. package/.output/server/node_modules/typeorm/query-builder/QueryBuilder.js +1139 -0
  800. package/.output/server/node_modules/typeorm/query-builder/QueryBuilderUtils.js +32 -0
  801. package/.output/server/node_modules/typeorm/query-builder/QueryExpressionMap.js +328 -0
  802. package/.output/server/node_modules/typeorm/query-builder/RelationIdLoader.js +503 -0
  803. package/.output/server/node_modules/typeorm/query-builder/RelationLoader.js +283 -0
  804. package/.output/server/node_modules/typeorm/query-builder/RelationQueryBuilder.js +155 -0
  805. package/.output/server/node_modules/typeorm/query-builder/RelationRemover.js +143 -0
  806. package/.output/server/node_modules/typeorm/query-builder/RelationUpdater.js +152 -0
  807. package/.output/server/node_modules/typeorm/query-builder/ReturningResultsEntityUpdator.js +176 -0
  808. package/.output/server/node_modules/typeorm/query-builder/SelectQueryBuilder.js +2656 -0
  809. package/.output/server/node_modules/typeorm/query-builder/SoftDeleteQueryBuilder.js +368 -0
  810. package/.output/server/node_modules/typeorm/query-builder/UpdateQueryBuilder.js +498 -0
  811. package/.output/server/node_modules/typeorm/query-builder/index.js +20 -0
  812. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountAttribute.js +80 -0
  813. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountLoader.js +168 -0
  814. package/.output/server/node_modules/typeorm/query-builder/relation-count/RelationCountMetadataToAttributeTransformer.js +55 -0
  815. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdAttribute.js +88 -0
  816. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdLoader.js +275 -0
  817. package/.output/server/node_modules/typeorm/query-builder/relation-id/RelationIdMetadataToAttributeTransformer.js +55 -0
  818. package/.output/server/node_modules/typeorm/query-builder/result/DeleteResult.js +17 -0
  819. package/.output/server/node_modules/typeorm/query-builder/result/InsertResult.js +28 -0
  820. package/.output/server/node_modules/typeorm/query-builder/result/UpdateResult.js +29 -0
  821. package/.output/server/node_modules/typeorm/query-builder/transformer/DocumentToEntityTransformer.js +196 -0
  822. package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToDatabaseEntityTransformer.js +112 -0
  823. package/.output/server/node_modules/typeorm/query-builder/transformer/PlainObjectToNewEntityTransformer.js +92 -0
  824. package/.output/server/node_modules/typeorm/query-builder/transformer/RawSqlResultsToEntityTransformer.js +447 -0
  825. package/.output/server/node_modules/typeorm/query-runner/BaseQueryRunner.js +454 -0
  826. package/.output/server/node_modules/typeorm/query-runner/QueryLock.js +28 -0
  827. package/.output/server/node_modules/typeorm/query-runner/QueryResult.js +17 -0
  828. package/.output/server/node_modules/typeorm/repository/AbstractRepository.js +92 -0
  829. package/.output/server/node_modules/typeorm/repository/BaseEntity.js +328 -0
  830. package/.output/server/node_modules/typeorm/repository/MongoRepository.js +305 -0
  831. package/.output/server/node_modules/typeorm/repository/RemoveOptions.js +4 -0
  832. package/.output/server/node_modules/typeorm/repository/Repository.js +379 -0
  833. package/.output/server/node_modules/typeorm/repository/SaveOptions.js +4 -0
  834. package/.output/server/node_modules/typeorm/repository/TreeRepository.js +255 -0
  835. package/.output/server/node_modules/typeorm/schema-builder/MongoSchemaBuilder.js +66 -0
  836. package/.output/server/node_modules/typeorm/schema-builder/RdbmsSchemaBuilder.js +929 -0
  837. package/.output/server/node_modules/typeorm/schema-builder/options/TableCheckOptions.js +4 -0
  838. package/.output/server/node_modules/typeorm/schema-builder/options/TableColumnOptions.js +4 -0
  839. package/.output/server/node_modules/typeorm/schema-builder/options/TableExclusionOptions.js +4 -0
  840. package/.output/server/node_modules/typeorm/schema-builder/options/TableForeignKeyOptions.js +4 -0
  841. package/.output/server/node_modules/typeorm/schema-builder/options/TableIndexOptions.js +4 -0
  842. package/.output/server/node_modules/typeorm/schema-builder/options/TableOptions.js +4 -0
  843. package/.output/server/node_modules/typeorm/schema-builder/options/TableUniqueOptions.js +4 -0
  844. package/.output/server/node_modules/typeorm/schema-builder/options/ViewOptions.js +4 -0
  845. package/.output/server/node_modules/typeorm/schema-builder/table/Table.js +296 -0
  846. package/.output/server/node_modules/typeorm/schema-builder/table/TableCheck.js +49 -0
  847. package/.output/server/node_modules/typeorm/schema-builder/table/TableColumn.js +117 -0
  848. package/.output/server/node_modules/typeorm/schema-builder/table/TableExclusion.js +43 -0
  849. package/.output/server/node_modules/typeorm/schema-builder/table/TableForeignKey.js +72 -0
  850. package/.output/server/node_modules/typeorm/schema-builder/table/TableIndex.js +68 -0
  851. package/.output/server/node_modules/typeorm/schema-builder/table/TableUnique.js +50 -0
  852. package/.output/server/node_modules/typeorm/schema-builder/util/TableUtils.js +41 -0
  853. package/.output/server/node_modules/typeorm/schema-builder/util/ViewUtils.js +27 -0
  854. package/.output/server/node_modules/typeorm/schema-builder/view/View.js +71 -0
  855. package/.output/server/node_modules/typeorm/subscriber/Broadcaster.js +660 -0
  856. package/.output/server/node_modules/typeorm/subscriber/BroadcasterResult.js +30 -0
  857. package/.output/server/node_modules/typeorm/subscriber/event/QueryEvent.js +4 -0
  858. package/.output/server/node_modules/typeorm/util/ApplyValueTransformers.js +25 -0
  859. package/.output/server/node_modules/typeorm/util/DateUtils.js +229 -0
  860. package/.output/server/node_modules/typeorm/util/DepGraph.js +230 -0
  861. package/.output/server/node_modules/typeorm/util/DirectoryExportedClassesLoader.js +65 -0
  862. package/.output/server/node_modules/typeorm/util/ImportUtils.js +66 -0
  863. package/.output/server/node_modules/typeorm/util/InstanceChecker.js +104 -0
  864. package/.output/server/node_modules/typeorm/util/ObjectUtils.js +49 -0
  865. package/.output/server/node_modules/typeorm/util/OrmUtils.js +443 -0
  866. package/.output/server/node_modules/typeorm/util/PathUtils.js +33 -0
  867. package/.output/server/node_modules/typeorm/util/RandomGenerator.js +154 -0
  868. package/.output/server/node_modules/typeorm/util/SqlTagUtils.js +43 -0
  869. package/.output/server/node_modules/typeorm/util/StringUtils.js +113 -0
  870. package/.output/server/node_modules/typeorm/util/TreeRepositoryUtils.js +67 -0
  871. package/.output/server/node_modules/typeorm/util/VersionUtils.js +27 -0
  872. package/.output/server/node_modules/typeorm/util/escapeRegExp.js +10 -0
  873. package/.output/server/node_modules/ufo/dist/index.mjs +630 -0
  874. package/.output/server/node_modules/ufo/package.json +47 -0
  875. package/.output/server/node_modules/unhead/dist/plugins.mjs +94 -0
  876. package/.output/server/node_modules/unhead/dist/server.mjs +220 -0
  877. package/.output/server/node_modules/unhead/dist/shared/unhead.C13swrCa.mjs +48 -0
  878. package/.output/server/node_modules/unhead/dist/shared/unhead.CApf5sj3.mjs +148 -0
  879. package/.output/server/node_modules/unhead/dist/shared/unhead.Cp0iF6eN.mjs +177 -0
  880. package/.output/server/node_modules/unhead/dist/shared/unhead.DGkFBTYv.mjs +172 -0
  881. package/.output/server/node_modules/unhead/dist/shared/unhead.DQc16pHI.mjs +196 -0
  882. package/.output/server/node_modules/unhead/dist/shared/unhead.DZbvapt-.mjs +70 -0
  883. package/.output/server/node_modules/unhead/dist/shared/unhead.DeCxexjU.mjs +166 -0
  884. package/.output/server/node_modules/unhead/dist/shared/unhead.yem5I2v_.mjs +38 -0
  885. package/.output/server/node_modules/unhead/dist/utils.mjs +5 -0
  886. package/.output/server/node_modules/unhead/package.json +101 -0
  887. package/.output/server/node_modules/uuid/dist/cjs/index.js +31 -0
  888. package/.output/server/node_modules/uuid/dist/cjs/max.js +3 -0
  889. package/.output/server/node_modules/uuid/dist/cjs/md5.js +13 -0
  890. package/.output/server/node_modules/uuid/dist/cjs/native.js +4 -0
  891. package/.output/server/node_modules/uuid/dist/cjs/nil.js +3 -0
  892. package/.output/server/node_modules/uuid/dist/cjs/package.json +1 -0
  893. package/.output/server/node_modules/uuid/dist/cjs/parse.js +11 -0
  894. package/.output/server/node_modules/uuid/dist/cjs/regex.js +3 -0
  895. package/.output/server/node_modules/uuid/dist/cjs/rng.js +13 -0
  896. package/.output/server/node_modules/uuid/dist/cjs/sha1.js +13 -0
  897. package/.output/server/node_modules/uuid/dist/cjs/stringify.js +39 -0
  898. package/.output/server/node_modules/uuid/dist/cjs/v1.js +87 -0
  899. package/.output/server/node_modules/uuid/dist/cjs/v1ToV6.js +13 -0
  900. package/.output/server/node_modules/uuid/dist/cjs/v3.js +14 -0
  901. package/.output/server/node_modules/uuid/dist/cjs/v35.js +41 -0
  902. package/.output/server/node_modules/uuid/dist/cjs/v4.js +29 -0
  903. package/.output/server/node_modules/uuid/dist/cjs/v5.js +14 -0
  904. package/.output/server/node_modules/uuid/dist/cjs/v6.js +19 -0
  905. package/.output/server/node_modules/uuid/dist/cjs/v6ToV1.js +13 -0
  906. package/.output/server/node_modules/uuid/dist/cjs/v7.js +69 -0
  907. package/.output/server/node_modules/uuid/dist/cjs/validate.js +7 -0
  908. package/.output/server/node_modules/uuid/dist/cjs/version.js +10 -0
  909. package/.output/server/node_modules/uuid/package.json +132 -0
  910. package/.output/server/node_modules/vue/dist/vue.cjs.js +80 -0
  911. package/.output/server/node_modules/vue/dist/vue.cjs.prod.js +66 -0
  912. package/.output/server/node_modules/vue/index.js +7 -0
  913. package/.output/server/node_modules/vue/index.mjs +1 -0
  914. package/.output/server/node_modules/vue/package.json +112 -0
  915. package/.output/server/node_modules/vue/server-renderer/index.mjs +1 -0
  916. package/.output/server/node_modules/vue-bundle-renderer/dist/runtime.mjs +196 -0
  917. package/.output/server/node_modules/vue-bundle-renderer/package.json +50 -0
  918. package/.output/server/node_modules/xtend/mutable.js +17 -0
  919. package/.output/server/node_modules/xtend/package.json +55 -0
  920. package/.output/server/node_modules/zod/index.js +4 -0
  921. package/.output/server/node_modules/zod/package.json +135 -0
  922. package/.output/server/node_modules/zod/v3/ZodError.js +133 -0
  923. package/.output/server/node_modules/zod/v3/errors.js +9 -0
  924. package/.output/server/node_modules/zod/v3/external.js +6 -0
  925. package/.output/server/node_modules/zod/v3/helpers/errorUtil.js +6 -0
  926. package/.output/server/node_modules/zod/v3/helpers/parseUtil.js +109 -0
  927. package/.output/server/node_modules/zod/v3/helpers/typeAliases.js +1 -0
  928. package/.output/server/node_modules/zod/v3/helpers/util.js +133 -0
  929. package/.output/server/node_modules/zod/v3/index.js +4 -0
  930. package/.output/server/node_modules/zod/v3/locales/en.js +109 -0
  931. package/.output/server/node_modules/zod/v3/package.json +6 -0
  932. package/.output/server/node_modules/zod/v3/types.js +3695 -0
  933. package/.output/server/node_modules/zod/v4/classic/checks.js +1 -0
  934. package/.output/server/node_modules/zod/v4/classic/coerce.js +17 -0
  935. package/.output/server/node_modules/zod/v4/classic/compat.js +31 -0
  936. package/.output/server/node_modules/zod/v4/classic/errors.js +48 -0
  937. package/.output/server/node_modules/zod/v4/classic/external.js +20 -0
  938. package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +584 -0
  939. package/.output/server/node_modules/zod/v4/classic/index.js +4 -0
  940. package/.output/server/node_modules/zod/v4/classic/iso.js +30 -0
  941. package/.output/server/node_modules/zod/v4/classic/package.json +6 -0
  942. package/.output/server/node_modules/zod/v4/classic/parse.js +15 -0
  943. package/.output/server/node_modules/zod/v4/classic/schemas.js +1157 -0
  944. package/.output/server/node_modules/zod/v4/core/api.js +1082 -0
  945. package/.output/server/node_modules/zod/v4/core/checks.js +575 -0
  946. package/.output/server/node_modules/zod/v4/core/core.js +76 -0
  947. package/.output/server/node_modules/zod/v4/core/doc.js +35 -0
  948. package/.output/server/node_modules/zod/v4/core/errors.js +182 -0
  949. package/.output/server/node_modules/zod/v4/core/index.js +16 -0
  950. package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +95 -0
  951. package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +605 -0
  952. package/.output/server/node_modules/zod/v4/core/json-schema.js +1 -0
  953. package/.output/server/node_modules/zod/v4/core/package.json +6 -0
  954. package/.output/server/node_modules/zod/v4/core/parse.js +93 -0
  955. package/.output/server/node_modules/zod/v4/core/regexes.js +133 -0
  956. package/.output/server/node_modules/zod/v4/core/registries.js +51 -0
  957. package/.output/server/node_modules/zod/v4/core/schemas.js +2095 -0
  958. package/.output/server/node_modules/zod/v4/core/to-json-schema.js +437 -0
  959. package/.output/server/node_modules/zod/v4/core/util.js +651 -0
  960. package/.output/server/node_modules/zod/v4/core/versions.js +5 -0
  961. package/.output/server/node_modules/zod/v4/index.js +3 -0
  962. package/.output/server/node_modules/zod/v4/locales/ar.js +106 -0
  963. package/.output/server/node_modules/zod/v4/locales/az.js +105 -0
  964. package/.output/server/node_modules/zod/v4/locales/be.js +156 -0
  965. package/.output/server/node_modules/zod/v4/locales/bg.js +120 -0
  966. package/.output/server/node_modules/zod/v4/locales/ca.js +107 -0
  967. package/.output/server/node_modules/zod/v4/locales/cs.js +111 -0
  968. package/.output/server/node_modules/zod/v4/locales/da.js +115 -0
  969. package/.output/server/node_modules/zod/v4/locales/de.js +108 -0
  970. package/.output/server/node_modules/zod/v4/locales/en.js +109 -0
  971. package/.output/server/node_modules/zod/v4/locales/eo.js +109 -0
  972. package/.output/server/node_modules/zod/v4/locales/es.js +132 -0
  973. package/.output/server/node_modules/zod/v4/locales/fa.js +114 -0
  974. package/.output/server/node_modules/zod/v4/locales/fi.js +112 -0
  975. package/.output/server/node_modules/zod/v4/locales/fr-CA.js +107 -0
  976. package/.output/server/node_modules/zod/v4/locales/fr.js +108 -0
  977. package/.output/server/node_modules/zod/v4/locales/he.js +214 -0
  978. package/.output/server/node_modules/zod/v4/locales/hu.js +108 -0
  979. package/.output/server/node_modules/zod/v4/locales/hy.js +147 -0
  980. package/.output/server/node_modules/zod/v4/locales/id.js +106 -0
  981. package/.output/server/node_modules/zod/v4/locales/index.js +49 -0
  982. package/.output/server/node_modules/zod/v4/locales/is.js +109 -0
  983. package/.output/server/node_modules/zod/v4/locales/it.js +108 -0
  984. package/.output/server/node_modules/zod/v4/locales/ja.js +107 -0
  985. package/.output/server/node_modules/zod/v4/locales/ka.js +112 -0
  986. package/.output/server/node_modules/zod/v4/locales/kh.js +5 -0
  987. package/.output/server/node_modules/zod/v4/locales/km.js +110 -0
  988. package/.output/server/node_modules/zod/v4/locales/ko.js +111 -0
  989. package/.output/server/node_modules/zod/v4/locales/lt.js +203 -0
  990. package/.output/server/node_modules/zod/v4/locales/mk.js +109 -0
  991. package/.output/server/node_modules/zod/v4/locales/ms.js +107 -0
  992. package/.output/server/node_modules/zod/v4/locales/nl.js +110 -0
  993. package/.output/server/node_modules/zod/v4/locales/no.js +108 -0
  994. package/.output/server/node_modules/zod/v4/locales/ota.js +109 -0
  995. package/.output/server/node_modules/zod/v4/locales/package.json +6 -0
  996. package/.output/server/node_modules/zod/v4/locales/pl.js +109 -0
  997. package/.output/server/node_modules/zod/v4/locales/ps.js +114 -0
  998. package/.output/server/node_modules/zod/v4/locales/pt.js +108 -0
  999. package/.output/server/node_modules/zod/v4/locales/ru.js +156 -0
  1000. package/.output/server/node_modules/zod/v4/locales/sl.js +109 -0
  1001. package/.output/server/node_modules/zod/v4/locales/sv.js +110 -0
  1002. package/.output/server/node_modules/zod/v4/locales/ta.js +110 -0
  1003. package/.output/server/node_modules/zod/v4/locales/th.js +110 -0
  1004. package/.output/server/node_modules/zod/v4/locales/tr.js +105 -0
  1005. package/.output/server/node_modules/zod/v4/locales/ua.js +5 -0
  1006. package/.output/server/node_modules/zod/v4/locales/uk.js +108 -0
  1007. package/.output/server/node_modules/zod/v4/locales/ur.js +110 -0
  1008. package/.output/server/node_modules/zod/v4/locales/uz.js +109 -0
  1009. package/.output/server/node_modules/zod/v4/locales/vi.js +108 -0
  1010. package/.output/server/node_modules/zod/v4/locales/yo.js +107 -0
  1011. package/.output/server/node_modules/zod/v4/locales/zh-CN.js +109 -0
  1012. package/.output/server/node_modules/zod/v4/locales/zh-TW.js +107 -0
  1013. package/.output/server/node_modules/zod/v4/package.json +6 -0
  1014. package/.output/server/package.json +95 -0
  1015. package/README.md +46 -0
  1016. package/bin/cli.mjs +113 -0
  1017. package/bin/entry.cjs +84 -0
  1018. package/package.json +48 -0
@@ -0,0 +1,1884 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OracleQueryRunner = void 0;
4
+ const error_1 = require("../../error");
5
+ const QueryFailedError_1 = require("../../error/QueryFailedError");
6
+ const QueryRunnerAlreadyReleasedError_1 = require("../../error/QueryRunnerAlreadyReleasedError");
7
+ const TransactionNotStartedError_1 = require("../../error/TransactionNotStartedError");
8
+ const BaseQueryRunner_1 = require("../../query-runner/BaseQueryRunner");
9
+ const QueryResult_1 = require("../../query-runner/QueryResult");
10
+ const Table_1 = require("../../schema-builder/table/Table");
11
+ const TableCheck_1 = require("../../schema-builder/table/TableCheck");
12
+ const TableColumn_1 = require("../../schema-builder/table/TableColumn");
13
+ const TableForeignKey_1 = require("../../schema-builder/table/TableForeignKey");
14
+ const TableIndex_1 = require("../../schema-builder/table/TableIndex");
15
+ const TableUnique_1 = require("../../schema-builder/table/TableUnique");
16
+ const View_1 = require("../../schema-builder/view/View");
17
+ const Broadcaster_1 = require("../../subscriber/Broadcaster");
18
+ const BroadcasterResult_1 = require("../../subscriber/BroadcasterResult");
19
+ const InstanceChecker_1 = require("../../util/InstanceChecker");
20
+ const OrmUtils_1 = require("../../util/OrmUtils");
21
+ const Query_1 = require("../Query");
22
+ const MetadataTableType_1 = require("../types/MetadataTableType");
23
+ /**
24
+ * Runs queries on a single oracle database connection.
25
+ */
26
+ class OracleQueryRunner extends BaseQueryRunner_1.BaseQueryRunner {
27
+ // -------------------------------------------------------------------------
28
+ // Constructor
29
+ // -------------------------------------------------------------------------
30
+ constructor(driver, mode) {
31
+ super();
32
+ this.driver = driver;
33
+ this.connection = driver.connection;
34
+ this.broadcaster = new Broadcaster_1.Broadcaster(this);
35
+ this.mode = mode;
36
+ }
37
+ // -------------------------------------------------------------------------
38
+ // Public Methods
39
+ // -------------------------------------------------------------------------
40
+ /**
41
+ * Creates/uses database connection from the connection pool to perform further operations.
42
+ * Returns obtained database connection.
43
+ */
44
+ connect() {
45
+ if (this.databaseConnection)
46
+ return Promise.resolve(this.databaseConnection);
47
+ if (this.databaseConnectionPromise)
48
+ return this.databaseConnectionPromise;
49
+ if (this.mode === "slave" && this.driver.isReplicated) {
50
+ this.databaseConnectionPromise = this.driver
51
+ .obtainSlaveConnection()
52
+ .then((connection) => {
53
+ this.databaseConnection = connection;
54
+ return this.databaseConnection;
55
+ });
56
+ }
57
+ else {
58
+ // master
59
+ this.databaseConnectionPromise = this.driver
60
+ .obtainMasterConnection()
61
+ .then((connection) => {
62
+ this.databaseConnection = connection;
63
+ return this.databaseConnection;
64
+ });
65
+ }
66
+ return this.databaseConnectionPromise;
67
+ }
68
+ /**
69
+ * Releases used database connection.
70
+ * You cannot use query runner methods once its released.
71
+ */
72
+ async release() {
73
+ this.isReleased = true;
74
+ if (!this.databaseConnection) {
75
+ return;
76
+ }
77
+ await this.databaseConnection.close();
78
+ }
79
+ /**
80
+ * Starts transaction.
81
+ */
82
+ async startTransaction(isolationLevel = "READ COMMITTED") {
83
+ if (this.isReleased)
84
+ throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
85
+ // await this.query("START TRANSACTION");
86
+ if (isolationLevel !== "SERIALIZABLE" &&
87
+ isolationLevel !== "READ COMMITTED") {
88
+ throw new error_1.TypeORMError(`Oracle only supports SERIALIZABLE and READ COMMITTED isolation`);
89
+ }
90
+ this.isTransactionActive = true;
91
+ try {
92
+ await this.broadcaster.broadcast("BeforeTransactionStart");
93
+ }
94
+ catch (err) {
95
+ this.isTransactionActive = false;
96
+ throw err;
97
+ }
98
+ if (this.transactionDepth === 0) {
99
+ await this.query("SET TRANSACTION ISOLATION LEVEL " + isolationLevel);
100
+ }
101
+ else {
102
+ await this.query(`SAVEPOINT typeorm_${this.transactionDepth}`);
103
+ }
104
+ this.transactionDepth += 1;
105
+ await this.broadcaster.broadcast("AfterTransactionStart");
106
+ }
107
+ /**
108
+ * Commits transaction.
109
+ * Error will be thrown if transaction was not started.
110
+ */
111
+ async commitTransaction() {
112
+ if (!this.isTransactionActive)
113
+ throw new TransactionNotStartedError_1.TransactionNotStartedError();
114
+ await this.broadcaster.broadcast("BeforeTransactionCommit");
115
+ if (this.transactionDepth === 1) {
116
+ await this.query("COMMIT");
117
+ this.isTransactionActive = false;
118
+ }
119
+ this.transactionDepth -= 1;
120
+ await this.broadcaster.broadcast("AfterTransactionCommit");
121
+ }
122
+ /**
123
+ * Rollbacks transaction.
124
+ * Error will be thrown if transaction was not started.
125
+ */
126
+ async rollbackTransaction() {
127
+ if (!this.isTransactionActive)
128
+ throw new TransactionNotStartedError_1.TransactionNotStartedError();
129
+ await this.broadcaster.broadcast("BeforeTransactionRollback");
130
+ if (this.transactionDepth > 1) {
131
+ await this.query(`ROLLBACK TO SAVEPOINT typeorm_${this.transactionDepth - 1}`);
132
+ }
133
+ else {
134
+ await this.query("ROLLBACK");
135
+ this.isTransactionActive = false;
136
+ }
137
+ this.transactionDepth -= 1;
138
+ await this.broadcaster.broadcast("AfterTransactionRollback");
139
+ }
140
+ /**
141
+ * Executes a given SQL query.
142
+ */
143
+ async query(query, parameters, useStructuredResult = false) {
144
+ if (this.isReleased)
145
+ throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
146
+ const databaseConnection = await this.connect();
147
+ this.driver.connection.logger.logQuery(query, parameters, this);
148
+ await this.broadcaster.broadcast("BeforeQuery", query, parameters);
149
+ const broadcasterResult = new BroadcasterResult_1.BroadcasterResult();
150
+ const queryStartTime = Date.now();
151
+ try {
152
+ const executionOptions = {
153
+ autoCommit: !this.isTransactionActive,
154
+ outFormat: this.driver.oracle.OUT_FORMAT_OBJECT,
155
+ };
156
+ const raw = await databaseConnection.execute(query, parameters || {}, executionOptions);
157
+ // log slow queries if maxQueryExecution time is set
158
+ const maxQueryExecutionTime = this.driver.options.maxQueryExecutionTime;
159
+ const queryEndTime = Date.now();
160
+ const queryExecutionTime = queryEndTime - queryStartTime;
161
+ this.broadcaster.broadcastAfterQueryEvent(broadcasterResult, query, parameters, true, queryExecutionTime, raw, undefined);
162
+ if (maxQueryExecutionTime &&
163
+ queryExecutionTime > maxQueryExecutionTime)
164
+ this.driver.connection.logger.logQuerySlow(queryExecutionTime, query, parameters, this);
165
+ const result = new QueryResult_1.QueryResult();
166
+ result.raw =
167
+ raw.rows ||
168
+ raw.outBinds ||
169
+ raw.rowsAffected ||
170
+ raw.implicitResults;
171
+ if (raw?.hasOwnProperty("rows") && Array.isArray(raw.rows)) {
172
+ result.records = raw.rows;
173
+ }
174
+ if (raw?.hasOwnProperty("outBinds") &&
175
+ Array.isArray(raw.outBinds)) {
176
+ result.records = raw.outBinds;
177
+ }
178
+ if (raw?.hasOwnProperty("implicitResults") &&
179
+ Array.isArray(raw.implicitResults)) {
180
+ result.records = raw.implicitResults;
181
+ }
182
+ if (raw?.hasOwnProperty("rowsAffected")) {
183
+ result.affected = raw.rowsAffected;
184
+ }
185
+ if (useStructuredResult) {
186
+ return result;
187
+ }
188
+ else {
189
+ return result.raw;
190
+ }
191
+ }
192
+ catch (err) {
193
+ this.driver.connection.logger.logQueryError(err, query, parameters, this);
194
+ this.broadcaster.broadcastAfterQueryEvent(broadcasterResult, query, parameters, false, undefined, undefined, err);
195
+ throw new QueryFailedError_1.QueryFailedError(query, parameters, err);
196
+ }
197
+ finally {
198
+ await broadcasterResult.wait();
199
+ }
200
+ }
201
+ /**
202
+ * Returns raw data stream.
203
+ */
204
+ async stream(query, parameters, onEnd, onError) {
205
+ if (this.isReleased) {
206
+ throw new QueryRunnerAlreadyReleasedError_1.QueryRunnerAlreadyReleasedError();
207
+ }
208
+ const executionOptions = {
209
+ autoCommit: !this.isTransactionActive,
210
+ outFormat: this.driver.oracle.OUT_FORMAT_OBJECT,
211
+ };
212
+ const databaseConnection = await this.connect();
213
+ this.driver.connection.logger.logQuery(query, parameters, this);
214
+ try {
215
+ const stream = databaseConnection.queryStream(query, parameters, executionOptions);
216
+ if (onEnd) {
217
+ stream.on("end", onEnd);
218
+ }
219
+ if (onError) {
220
+ stream.on("error", onError);
221
+ }
222
+ return stream;
223
+ }
224
+ catch (err) {
225
+ this.driver.connection.logger.logQueryError(err, query, parameters, this);
226
+ throw new QueryFailedError_1.QueryFailedError(query, parameters, err);
227
+ }
228
+ }
229
+ /**
230
+ * Returns all available database names including system databases.
231
+ */
232
+ async getDatabases() {
233
+ return Promise.resolve([]);
234
+ }
235
+ /**
236
+ * Returns all available schema names including system schemas.
237
+ * If database parameter specified, returns schemas of that database.
238
+ */
239
+ async getSchemas(database) {
240
+ return Promise.resolve([]);
241
+ }
242
+ /**
243
+ * Checks if database with the given name exist.
244
+ */
245
+ async hasDatabase(database) {
246
+ try {
247
+ const query = await this.query(`SELECT 1 AS "exists" FROM global_name@"${database}"`);
248
+ return query.length > 0;
249
+ }
250
+ catch (e) {
251
+ return false;
252
+ }
253
+ }
254
+ /**
255
+ * Loads currently using database
256
+ */
257
+ async getCurrentDatabase() {
258
+ const query = await this.query(`SELECT SYS_CONTEXT('USERENV','DB_NAME') AS "db_name" FROM dual`);
259
+ return query[0]["db_name"];
260
+ }
261
+ /**
262
+ * Checks if schema with the given name exist.
263
+ */
264
+ async hasSchema(schema) {
265
+ return Promise.resolve(false);
266
+ }
267
+ /**
268
+ * Loads currently using database schema
269
+ */
270
+ async getCurrentSchema() {
271
+ const query = await this.query(`SELECT SYS_CONTEXT('USERENV','CURRENT_SCHEMA') AS "schema_name" FROM dual`);
272
+ return query[0]["schema_name"];
273
+ }
274
+ /**
275
+ * Checks if table with the given name exist in the database.
276
+ */
277
+ async hasTable(tableOrName) {
278
+ const { tableName } = this.driver.parseTableName(tableOrName);
279
+ const sql = `SELECT "TABLE_NAME" FROM "USER_TABLES" WHERE "TABLE_NAME" = '${tableName}'`;
280
+ const result = await this.query(sql);
281
+ return result.length ? true : false;
282
+ }
283
+ /**
284
+ * Checks if column with the given name exist in the given table.
285
+ */
286
+ async hasColumn(tableOrName, columnName) {
287
+ const { tableName } = this.driver.parseTableName(tableOrName);
288
+ const sql = `SELECT "COLUMN_NAME" FROM "USER_TAB_COLS" WHERE "TABLE_NAME" = '${tableName}' AND "COLUMN_NAME" = '${columnName}'`;
289
+ const result = await this.query(sql);
290
+ return result.length ? true : false;
291
+ }
292
+ /**
293
+ * Creates a new database.
294
+ */
295
+ async createDatabase(database, ifNotExist) {
296
+ // Even with `IF NOT EXISTS` we get:
297
+ // ORA-01501: CREATE DATABASE failed
298
+ // ORA-01100: database already mounted
299
+ if (ifNotExist) {
300
+ try {
301
+ await this.query(`CREATE DATABASE IF NOT EXISTS "${database}";`);
302
+ }
303
+ catch (e) {
304
+ // if (e instanceof QueryFailedError) {
305
+ if (e.message.includes("ORA-01100: database already mounted")) {
306
+ return;
307
+ }
308
+ // }
309
+ throw e;
310
+ }
311
+ }
312
+ else {
313
+ await this.query(`CREATE DATABASE "${database}"`);
314
+ }
315
+ }
316
+ /**
317
+ * Drops database.
318
+ */
319
+ async dropDatabase(database, ifExist) {
320
+ return Promise.resolve();
321
+ }
322
+ /**
323
+ * Creates a new table schema.
324
+ */
325
+ async createSchema(schemaPath, ifNotExist) {
326
+ throw new error_1.TypeORMError(`Schema create queries are not supported by Oracle driver.`);
327
+ }
328
+ /**
329
+ * Drops table schema.
330
+ */
331
+ async dropSchema(schemaPath, ifExist) {
332
+ throw new error_1.TypeORMError(`Schema drop queries are not supported by Oracle driver.`);
333
+ }
334
+ /**
335
+ * Creates a new table.
336
+ */
337
+ async createTable(table, ifNotExist = false, createForeignKeys = true, createIndices = true) {
338
+ if (ifNotExist) {
339
+ const isTableExist = await this.hasTable(table);
340
+ if (isTableExist)
341
+ return Promise.resolve();
342
+ }
343
+ const upQueries = [];
344
+ const downQueries = [];
345
+ upQueries.push(this.createTableSql(table, createForeignKeys));
346
+ downQueries.push(this.dropTableSql(table));
347
+ // if createForeignKeys is true, we must drop created foreign keys in down query.
348
+ // createTable does not need separate method to create foreign keys, because it create fk's in the same query with table creation.
349
+ if (createForeignKeys)
350
+ table.foreignKeys.forEach((foreignKey) => downQueries.push(this.dropForeignKeySql(table, foreignKey)));
351
+ if (createIndices) {
352
+ table.indices.forEach((index) => {
353
+ // new index may be passed without name. In this case we generate index name manually.
354
+ if (!index.name)
355
+ index.name = this.connection.namingStrategy.indexName(table, index.columnNames, index.where);
356
+ upQueries.push(this.createIndexSql(table, index));
357
+ downQueries.push(this.dropIndexSql(index));
358
+ });
359
+ }
360
+ // if table have column with generated type, we must add the expression to the metadata table
361
+ const generatedColumns = table.columns.filter((column) => column.generatedType && column.asExpression);
362
+ for (const column of generatedColumns) {
363
+ const insertQuery = this.insertTypeormMetadataSql({
364
+ table: table.name,
365
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
366
+ name: column.name,
367
+ value: column.asExpression,
368
+ });
369
+ const deleteQuery = this.deleteTypeormMetadataSql({
370
+ table: table.name,
371
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
372
+ name: column.name,
373
+ });
374
+ upQueries.push(insertQuery);
375
+ downQueries.push(deleteQuery);
376
+ }
377
+ await this.executeQueries(upQueries, downQueries);
378
+ }
379
+ /**
380
+ * Drops the table.
381
+ */
382
+ async dropTable(tableOrName, ifExist, dropForeignKeys = true, dropIndices = true) {
383
+ // It needs because if table does not exist and dropForeignKeys or dropIndices is true, we don't need
384
+ // to perform drop queries for foreign keys and indices.
385
+ if (ifExist) {
386
+ const isTableExist = await this.hasTable(tableOrName);
387
+ if (!isTableExist)
388
+ return Promise.resolve();
389
+ }
390
+ // if dropTable called with dropForeignKeys = true, we must create foreign keys in down query.
391
+ const createForeignKeys = dropForeignKeys;
392
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
393
+ ? tableOrName
394
+ : await this.getCachedTable(tableOrName);
395
+ const upQueries = [];
396
+ const downQueries = [];
397
+ if (dropIndices) {
398
+ table.indices.forEach((index) => {
399
+ upQueries.push(this.dropIndexSql(index));
400
+ downQueries.push(this.createIndexSql(table, index));
401
+ });
402
+ }
403
+ // if dropForeignKeys is true, we just drop the table, otherwise we also drop table foreign keys.
404
+ // createTable does not need separate method to create foreign keys, because it create fk's in the same query with table creation.
405
+ if (dropForeignKeys)
406
+ table.foreignKeys.forEach((foreignKey) => upQueries.push(this.dropForeignKeySql(table, foreignKey)));
407
+ upQueries.push(this.dropTableSql(table));
408
+ downQueries.push(this.createTableSql(table, createForeignKeys));
409
+ // if table had columns with generated type, we must remove the expression from the metadata table
410
+ const generatedColumns = table.columns.filter((column) => column.generatedType && column.asExpression);
411
+ for (const column of generatedColumns) {
412
+ const deleteQuery = this.deleteTypeormMetadataSql({
413
+ table: table.name,
414
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
415
+ name: column.name,
416
+ });
417
+ const insertQuery = this.insertTypeormMetadataSql({
418
+ table: table.name,
419
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
420
+ name: column.name,
421
+ value: column.asExpression,
422
+ });
423
+ upQueries.push(deleteQuery);
424
+ downQueries.push(insertQuery);
425
+ }
426
+ await this.executeQueries(upQueries, downQueries);
427
+ }
428
+ /**
429
+ * Creates a new view.
430
+ */
431
+ async createView(view, syncWithMetadata = false) {
432
+ const upQueries = [];
433
+ const downQueries = [];
434
+ upQueries.push(this.createViewSql(view));
435
+ if (syncWithMetadata)
436
+ upQueries.push(this.insertViewDefinitionSql(view));
437
+ downQueries.push(this.dropViewSql(view));
438
+ if (syncWithMetadata)
439
+ downQueries.push(this.deleteViewDefinitionSql(view));
440
+ await this.executeQueries(upQueries, downQueries);
441
+ }
442
+ /**
443
+ * Drops the view.
444
+ */
445
+ async dropView(target) {
446
+ const viewName = InstanceChecker_1.InstanceChecker.isView(target) ? target.name : target;
447
+ const view = await this.getCachedView(viewName);
448
+ const upQueries = [];
449
+ const downQueries = [];
450
+ upQueries.push(this.deleteViewDefinitionSql(view));
451
+ upQueries.push(this.dropViewSql(view));
452
+ downQueries.push(this.insertViewDefinitionSql(view));
453
+ downQueries.push(this.createViewSql(view));
454
+ await this.executeQueries(upQueries, downQueries);
455
+ }
456
+ /**
457
+ * Renames the given table.
458
+ */
459
+ async renameTable(oldTableOrName, newTableName) {
460
+ const upQueries = [];
461
+ const downQueries = [];
462
+ const oldTable = InstanceChecker_1.InstanceChecker.isTable(oldTableOrName)
463
+ ? oldTableOrName
464
+ : await this.getCachedTable(oldTableOrName);
465
+ const newTable = oldTable.clone();
466
+ const { database: dbName, tableName: oldTableName } = this.driver.parseTableName(oldTable);
467
+ newTable.name = dbName ? `${dbName}.${newTableName}` : newTableName;
468
+ // rename table
469
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(oldTable)} RENAME TO "${newTableName}"`));
470
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME TO "${oldTableName}"`));
471
+ // rename primary key constraint
472
+ if (newTable.primaryColumns.length > 0 &&
473
+ !newTable.primaryColumns[0].primaryKeyConstraintName) {
474
+ const columnNames = newTable.primaryColumns.map((column) => column.name);
475
+ const oldPkName = this.connection.namingStrategy.primaryKeyName(oldTable, columnNames);
476
+ const newPkName = this.connection.namingStrategy.primaryKeyName(newTable, columnNames);
477
+ // build queries
478
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${oldPkName}" TO "${newPkName}"`));
479
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${newPkName}" TO "${oldPkName}"`));
480
+ }
481
+ // rename unique constraints
482
+ newTable.uniques.forEach((unique) => {
483
+ const oldUniqueName = this.connection.namingStrategy.uniqueConstraintName(oldTable, unique.columnNames);
484
+ // Skip renaming if Unique has user defined constraint name
485
+ if (unique.name !== oldUniqueName)
486
+ return;
487
+ // build new constraint name
488
+ const newUniqueName = this.connection.namingStrategy.uniqueConstraintName(newTable, unique.columnNames);
489
+ // build queries
490
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${unique.name}" TO "${newUniqueName}"`));
491
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${newUniqueName}" TO "${unique.name}"`));
492
+ // replace constraint name
493
+ unique.name = newUniqueName;
494
+ });
495
+ // rename index constraints
496
+ newTable.indices.forEach((index) => {
497
+ const oldIndexName = this.connection.namingStrategy.indexName(oldTable, index.columnNames, index.where);
498
+ // Skip renaming if Index has user defined constraint name
499
+ if (index.name !== oldIndexName)
500
+ return;
501
+ // build new constraint name
502
+ const newIndexName = this.connection.namingStrategy.indexName(newTable, index.columnNames, index.where);
503
+ // build queries
504
+ upQueries.push(new Query_1.Query(`ALTER INDEX "${index.name}" RENAME TO "${newIndexName}"`));
505
+ downQueries.push(new Query_1.Query(`ALTER INDEX "${newIndexName}" RENAME TO "${index.name}"`));
506
+ // replace constraint name
507
+ index.name = newIndexName;
508
+ });
509
+ // rename foreign key constraints
510
+ newTable.foreignKeys.forEach((foreignKey) => {
511
+ const oldForeignKeyName = this.connection.namingStrategy.foreignKeyName(oldTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames);
512
+ // Skip renaming if foreign key has user defined constraint name
513
+ if (foreignKey.name !== oldForeignKeyName)
514
+ return;
515
+ // build new constraint name
516
+ const newForeignKeyName = this.connection.namingStrategy.foreignKeyName(newTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames);
517
+ // build queries
518
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${foreignKey.name}" TO "${newForeignKeyName}"`));
519
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(newTable)} RENAME CONSTRAINT "${newForeignKeyName}" TO "${foreignKey.name}"`));
520
+ // replace constraint name
521
+ foreignKey.name = newForeignKeyName;
522
+ });
523
+ await this.executeQueries(upQueries, downQueries);
524
+ // rename old table and replace it in cached tabled;
525
+ oldTable.name = newTable.name;
526
+ this.replaceCachedTable(oldTable, newTable);
527
+ }
528
+ /**
529
+ * Creates a new column from the column in the table.
530
+ */
531
+ async addColumn(tableOrName, column) {
532
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
533
+ ? tableOrName
534
+ : await this.getCachedTable(tableOrName);
535
+ const clonedTable = table.clone();
536
+ const upQueries = [];
537
+ const downQueries = [];
538
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD ${this.buildCreateColumnSql(column)}`));
539
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP COLUMN "${column.name}"`));
540
+ // create or update primary key constraint
541
+ if (column.isPrimary) {
542
+ const primaryColumns = clonedTable.primaryColumns;
543
+ // if table already have primary key, me must drop it and recreate again
544
+ if (primaryColumns.length > 0) {
545
+ const pkName = primaryColumns[0].primaryKeyConstraintName
546
+ ? primaryColumns[0].primaryKeyConstraintName
547
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
548
+ const columnNames = primaryColumns
549
+ .map((column) => `"${column.name}"`)
550
+ .join(", ");
551
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
552
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
553
+ }
554
+ primaryColumns.push(column);
555
+ const pkName = primaryColumns[0].primaryKeyConstraintName
556
+ ? primaryColumns[0].primaryKeyConstraintName
557
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
558
+ const columnNames = primaryColumns
559
+ .map((column) => `"${column.name}"`)
560
+ .join(", ");
561
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
562
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
563
+ }
564
+ // create column index
565
+ const columnIndex = clonedTable.indices.find((index) => index.columnNames.length === 1 &&
566
+ index.columnNames[0] === column.name);
567
+ if (columnIndex) {
568
+ clonedTable.indices.splice(clonedTable.indices.indexOf(columnIndex), 1);
569
+ upQueries.push(this.createIndexSql(table, columnIndex));
570
+ downQueries.push(this.dropIndexSql(columnIndex));
571
+ }
572
+ // create unique constraint
573
+ if (column.isUnique) {
574
+ const uniqueConstraint = new TableUnique_1.TableUnique({
575
+ name: this.connection.namingStrategy.uniqueConstraintName(table, [column.name]),
576
+ columnNames: [column.name],
577
+ });
578
+ clonedTable.uniques.push(uniqueConstraint);
579
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${uniqueConstraint.name}" UNIQUE ("${column.name}")`));
580
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${uniqueConstraint.name}"`));
581
+ }
582
+ if (column.generatedType && column.asExpression) {
583
+ const insertQuery = this.insertTypeormMetadataSql({
584
+ table: table.name,
585
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
586
+ name: column.name,
587
+ value: column.asExpression,
588
+ });
589
+ const deleteQuery = this.deleteTypeormMetadataSql({
590
+ table: table.name,
591
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
592
+ name: column.name,
593
+ });
594
+ upQueries.push(insertQuery);
595
+ downQueries.push(deleteQuery);
596
+ }
597
+ await this.executeQueries(upQueries, downQueries);
598
+ clonedTable.addColumn(column);
599
+ this.replaceCachedTable(table, clonedTable);
600
+ }
601
+ /**
602
+ * Creates a new columns from the column in the table.
603
+ */
604
+ async addColumns(tableOrName, columns) {
605
+ for (const column of columns) {
606
+ await this.addColumn(tableOrName, column);
607
+ }
608
+ }
609
+ /**
610
+ * Renames column in the given table.
611
+ */
612
+ async renameColumn(tableOrName, oldTableColumnOrName, newTableColumnOrName) {
613
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
614
+ ? tableOrName
615
+ : await this.getCachedTable(tableOrName);
616
+ const oldColumn = InstanceChecker_1.InstanceChecker.isTableColumn(oldTableColumnOrName)
617
+ ? oldTableColumnOrName
618
+ : table.columns.find((c) => c.name === oldTableColumnOrName);
619
+ if (!oldColumn)
620
+ throw new error_1.TypeORMError(`Column "${oldTableColumnOrName}" was not found in the ${this.escapePath(table)} table.`);
621
+ let newColumn = undefined;
622
+ if (InstanceChecker_1.InstanceChecker.isTableColumn(newTableColumnOrName)) {
623
+ newColumn = newTableColumnOrName;
624
+ }
625
+ else {
626
+ newColumn = oldColumn.clone();
627
+ newColumn.name = newTableColumnOrName;
628
+ }
629
+ await this.changeColumn(table, oldColumn, newColumn);
630
+ }
631
+ /**
632
+ * Changes a column in the table.
633
+ */
634
+ async changeColumn(tableOrName, oldTableColumnOrName, newColumn) {
635
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
636
+ ? tableOrName
637
+ : await this.getCachedTable(tableOrName);
638
+ let clonedTable = table.clone();
639
+ const upQueries = [];
640
+ const downQueries = [];
641
+ const oldColumn = InstanceChecker_1.InstanceChecker.isTableColumn(oldTableColumnOrName)
642
+ ? oldTableColumnOrName
643
+ : table.columns.find((column) => column.name === oldTableColumnOrName);
644
+ if (!oldColumn)
645
+ throw new error_1.TypeORMError(`Column "${oldTableColumnOrName}" was not found in the ${this.escapePath(table)} table.`);
646
+ if ((newColumn.isGenerated !== oldColumn.isGenerated &&
647
+ newColumn.generationStrategy !== "uuid") ||
648
+ oldColumn.type !== newColumn.type ||
649
+ oldColumn.length !== newColumn.length ||
650
+ oldColumn.generatedType !== newColumn.generatedType ||
651
+ oldColumn.asExpression !== newColumn.asExpression) {
652
+ // Oracle does not support changing of IDENTITY column, so we must drop column and recreate it again.
653
+ // Also, we recreate column if column type changed
654
+ await this.dropColumn(table, oldColumn);
655
+ await this.addColumn(table, newColumn);
656
+ // update cloned table
657
+ clonedTable = table.clone();
658
+ }
659
+ else {
660
+ if (newColumn.name !== oldColumn.name) {
661
+ // rename column
662
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME COLUMN "${oldColumn.name}" TO "${newColumn.name}"`));
663
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME COLUMN "${newColumn.name}" TO "${oldColumn.name}"`));
664
+ // rename column primary key constraint
665
+ if (oldColumn.isPrimary === true &&
666
+ !oldColumn.primaryKeyConstraintName) {
667
+ const primaryColumns = clonedTable.primaryColumns;
668
+ // build old primary constraint name
669
+ const columnNames = primaryColumns.map((column) => column.name);
670
+ const oldPkName = this.connection.namingStrategy.primaryKeyName(clonedTable, columnNames);
671
+ // replace old column name with new column name
672
+ columnNames.splice(columnNames.indexOf(oldColumn.name), 1);
673
+ columnNames.push(newColumn.name);
674
+ // build new primary constraint name
675
+ const newPkName = this.connection.namingStrategy.primaryKeyName(clonedTable, columnNames);
676
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${oldPkName}" TO "${newPkName}"`));
677
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${newPkName}" TO "${oldPkName}"`));
678
+ }
679
+ // rename unique constraints
680
+ clonedTable.findColumnUniques(oldColumn).forEach((unique) => {
681
+ const oldUniqueName = this.connection.namingStrategy.uniqueConstraintName(clonedTable, unique.columnNames);
682
+ // Skip renaming if Unique has user defined constraint name
683
+ if (unique.name !== oldUniqueName)
684
+ return;
685
+ // build new constraint name
686
+ unique.columnNames.splice(unique.columnNames.indexOf(oldColumn.name), 1);
687
+ unique.columnNames.push(newColumn.name);
688
+ const newUniqueName = this.connection.namingStrategy.uniqueConstraintName(clonedTable, unique.columnNames);
689
+ // build queries
690
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${unique.name}" TO "${newUniqueName}"`));
691
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${newUniqueName}" TO "${unique.name}"`));
692
+ // replace constraint name
693
+ unique.name = newUniqueName;
694
+ });
695
+ // rename index constraints
696
+ clonedTable.findColumnIndices(oldColumn).forEach((index) => {
697
+ const oldIndexName = this.connection.namingStrategy.indexName(clonedTable, index.columnNames, index.where);
698
+ // Skip renaming if Index has user defined constraint name
699
+ if (index.name !== oldIndexName)
700
+ return;
701
+ // build new constraint name
702
+ index.columnNames.splice(index.columnNames.indexOf(oldColumn.name), 1);
703
+ index.columnNames.push(newColumn.name);
704
+ const newIndexName = this.connection.namingStrategy.indexName(clonedTable, index.columnNames, index.where);
705
+ // build queries
706
+ upQueries.push(new Query_1.Query(`ALTER INDEX "${index.name}" RENAME TO "${newIndexName}"`));
707
+ downQueries.push(new Query_1.Query(`ALTER INDEX "${newIndexName}" RENAME TO "${index.name}"`));
708
+ // replace constraint name
709
+ index.name = newIndexName;
710
+ });
711
+ // rename foreign key constraints
712
+ clonedTable
713
+ .findColumnForeignKeys(oldColumn)
714
+ .forEach((foreignKey) => {
715
+ const foreignKeyName = this.connection.namingStrategy.foreignKeyName(clonedTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames);
716
+ // Skip renaming if foreign key has user defined constraint name
717
+ if (foreignKey.name !== foreignKeyName)
718
+ return;
719
+ // build new constraint name
720
+ foreignKey.columnNames.splice(foreignKey.columnNames.indexOf(oldColumn.name), 1);
721
+ foreignKey.columnNames.push(newColumn.name);
722
+ const newForeignKeyName = this.connection.namingStrategy.foreignKeyName(clonedTable, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames);
723
+ // build queries
724
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${foreignKey.name}" TO "${newForeignKeyName}"`));
725
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} RENAME CONSTRAINT "${newForeignKeyName}" TO "${foreignKey.name}"`));
726
+ // replace constraint name
727
+ foreignKey.name = newForeignKeyName;
728
+ });
729
+ // rename old column in the Table object
730
+ const oldTableColumn = clonedTable.columns.find((column) => column.name === oldColumn.name);
731
+ clonedTable.columns[clonedTable.columns.indexOf(oldTableColumn)].name = newColumn.name;
732
+ oldColumn.name = newColumn.name;
733
+ }
734
+ if (this.isColumnChanged(oldColumn, newColumn, true)) {
735
+ let defaultUp = "";
736
+ let defaultDown = "";
737
+ let nullableUp = "";
738
+ let nullableDown = "";
739
+ // changing column default
740
+ if (newColumn.default !== null &&
741
+ newColumn.default !== undefined) {
742
+ defaultUp = `DEFAULT ${newColumn.default}`;
743
+ if (oldColumn.default !== null &&
744
+ oldColumn.default !== undefined) {
745
+ defaultDown = `DEFAULT ${oldColumn.default}`;
746
+ }
747
+ else {
748
+ defaultDown = "DEFAULT NULL";
749
+ }
750
+ }
751
+ else if (oldColumn.default !== null &&
752
+ oldColumn.default !== undefined) {
753
+ defaultUp = "DEFAULT NULL";
754
+ defaultDown = `DEFAULT ${oldColumn.default}`;
755
+ }
756
+ // changing column isNullable property
757
+ if (newColumn.isNullable !== oldColumn.isNullable) {
758
+ if (newColumn.isNullable === true) {
759
+ nullableUp = "NULL";
760
+ nullableDown = "NOT NULL";
761
+ }
762
+ else {
763
+ nullableUp = "NOT NULL";
764
+ nullableDown = "NULL";
765
+ }
766
+ }
767
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} MODIFY "${oldColumn.name}" ${this.connection.driver.createFullType(newColumn)} ${defaultUp} ${nullableUp}`));
768
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} MODIFY "${oldColumn.name}" ${this.connection.driver.createFullType(oldColumn)} ${defaultDown} ${nullableDown}`));
769
+ }
770
+ if (newColumn.isPrimary !== oldColumn.isPrimary) {
771
+ const primaryColumns = clonedTable.primaryColumns;
772
+ // if primary column state changed, we must always drop existed constraint.
773
+ if (primaryColumns.length > 0) {
774
+ const pkName = primaryColumns[0].primaryKeyConstraintName
775
+ ? primaryColumns[0].primaryKeyConstraintName
776
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
777
+ const columnNames = primaryColumns
778
+ .map((column) => `"${column.name}"`)
779
+ .join(", ");
780
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
781
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
782
+ }
783
+ if (newColumn.isPrimary === true) {
784
+ primaryColumns.push(newColumn);
785
+ // update column in table
786
+ const column = clonedTable.columns.find((column) => column.name === newColumn.name);
787
+ column.isPrimary = true;
788
+ const pkName = primaryColumns[0].primaryKeyConstraintName
789
+ ? primaryColumns[0].primaryKeyConstraintName
790
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
791
+ const columnNames = primaryColumns
792
+ .map((column) => `"${column.name}"`)
793
+ .join(", ");
794
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
795
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
796
+ }
797
+ else {
798
+ const primaryColumn = primaryColumns.find((c) => c.name === newColumn.name);
799
+ primaryColumns.splice(primaryColumns.indexOf(primaryColumn), 1);
800
+ // update column in table
801
+ const column = clonedTable.columns.find((column) => column.name === newColumn.name);
802
+ column.isPrimary = false;
803
+ // if we have another primary keys, we must recreate constraint.
804
+ if (primaryColumns.length > 0) {
805
+ const pkName = primaryColumns[0]
806
+ .primaryKeyConstraintName
807
+ ? primaryColumns[0].primaryKeyConstraintName
808
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
809
+ const columnNames = primaryColumns
810
+ .map((column) => `"${column.name}"`)
811
+ .join(", ");
812
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
813
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
814
+ }
815
+ }
816
+ }
817
+ if (newColumn.isUnique !== oldColumn.isUnique) {
818
+ if (newColumn.isUnique === true) {
819
+ const uniqueConstraint = new TableUnique_1.TableUnique({
820
+ name: this.connection.namingStrategy.uniqueConstraintName(table, [newColumn.name]),
821
+ columnNames: [newColumn.name],
822
+ });
823
+ clonedTable.uniques.push(uniqueConstraint);
824
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${uniqueConstraint.name}" UNIQUE ("${newColumn.name}")`));
825
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${uniqueConstraint.name}"`));
826
+ }
827
+ else {
828
+ const uniqueConstraint = clonedTable.uniques.find((unique) => {
829
+ return (unique.columnNames.length === 1 &&
830
+ !!unique.columnNames.find((columnName) => columnName === newColumn.name));
831
+ });
832
+ clonedTable.uniques.splice(clonedTable.uniques.indexOf(uniqueConstraint), 1);
833
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${uniqueConstraint.name}"`));
834
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${uniqueConstraint.name}" UNIQUE ("${newColumn.name}")`));
835
+ }
836
+ }
837
+ await this.executeQueries(upQueries, downQueries);
838
+ this.replaceCachedTable(table, clonedTable);
839
+ }
840
+ }
841
+ /**
842
+ * Changes a column in the table.
843
+ */
844
+ async changeColumns(tableOrName, changedColumns) {
845
+ for (const { oldColumn, newColumn } of changedColumns) {
846
+ await this.changeColumn(tableOrName, oldColumn, newColumn);
847
+ }
848
+ }
849
+ /**
850
+ * Drops column in the table.
851
+ */
852
+ async dropColumn(tableOrName, columnOrName) {
853
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
854
+ ? tableOrName
855
+ : await this.getCachedTable(tableOrName);
856
+ const column = InstanceChecker_1.InstanceChecker.isTableColumn(columnOrName)
857
+ ? columnOrName
858
+ : table.findColumnByName(columnOrName);
859
+ if (!column)
860
+ throw new error_1.TypeORMError(`Column "${columnOrName}" was not found in table ${this.escapePath(table)}`);
861
+ const clonedTable = table.clone();
862
+ const upQueries = [];
863
+ const downQueries = [];
864
+ // drop primary key constraint
865
+ if (column.isPrimary) {
866
+ const pkName = column.primaryKeyConstraintName
867
+ ? column.primaryKeyConstraintName
868
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, clonedTable.primaryColumns.map((column) => column.name));
869
+ const columnNames = clonedTable.primaryColumns
870
+ .map((primaryColumn) => `"${primaryColumn.name}"`)
871
+ .join(", ");
872
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(clonedTable)} DROP CONSTRAINT "${pkName}"`));
873
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(clonedTable)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
874
+ // update column in table
875
+ const tableColumn = clonedTable.findColumnByName(column.name);
876
+ tableColumn.isPrimary = false;
877
+ // if primary key have multiple columns, we must recreate it without dropped column
878
+ if (clonedTable.primaryColumns.length > 0) {
879
+ const pkName = clonedTable.primaryColumns[0]
880
+ .primaryKeyConstraintName
881
+ ? clonedTable.primaryColumns[0].primaryKeyConstraintName
882
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, clonedTable.primaryColumns.map((column) => column.name));
883
+ const columnNames = clonedTable.primaryColumns
884
+ .map((primaryColumn) => `"${primaryColumn.name}"`)
885
+ .join(", ");
886
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(clonedTable)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNames})`));
887
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(clonedTable)} DROP CONSTRAINT "${pkName}"`));
888
+ }
889
+ }
890
+ // drop column index
891
+ const columnIndex = clonedTable.indices.find((index) => index.columnNames.length === 1 &&
892
+ index.columnNames[0] === column.name);
893
+ if (columnIndex) {
894
+ upQueries.push(this.dropIndexSql(columnIndex));
895
+ downQueries.push(this.createIndexSql(table, columnIndex));
896
+ }
897
+ // drop column check
898
+ const columnCheck = clonedTable.checks.find((check) => !!check.columnNames &&
899
+ check.columnNames.length === 1 &&
900
+ check.columnNames[0] === column.name);
901
+ if (columnCheck) {
902
+ clonedTable.checks.splice(clonedTable.checks.indexOf(columnCheck), 1);
903
+ upQueries.push(this.dropCheckConstraintSql(table, columnCheck));
904
+ downQueries.push(this.createCheckConstraintSql(table, columnCheck));
905
+ }
906
+ // drop column unique
907
+ const columnUnique = clonedTable.uniques.find((unique) => unique.columnNames.length === 1 &&
908
+ unique.columnNames[0] === column.name);
909
+ if (columnUnique) {
910
+ clonedTable.uniques.splice(clonedTable.uniques.indexOf(columnUnique), 1);
911
+ upQueries.push(this.dropUniqueConstraintSql(table, columnUnique));
912
+ downQueries.push(this.createUniqueConstraintSql(table, columnUnique));
913
+ }
914
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP COLUMN "${column.name}"`));
915
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD ${this.buildCreateColumnSql(column)}`));
916
+ if (column.generatedType && column.asExpression) {
917
+ const deleteQuery = this.deleteTypeormMetadataSql({
918
+ table: table.name,
919
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
920
+ name: column.name,
921
+ });
922
+ const insertQuery = this.insertTypeormMetadataSql({
923
+ table: table.name,
924
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
925
+ name: column.name,
926
+ value: column.asExpression,
927
+ });
928
+ upQueries.push(deleteQuery);
929
+ downQueries.push(insertQuery);
930
+ }
931
+ await this.executeQueries(upQueries, downQueries);
932
+ clonedTable.removeColumn(column);
933
+ this.replaceCachedTable(table, clonedTable);
934
+ }
935
+ /**
936
+ * Drops the columns in the table.
937
+ */
938
+ async dropColumns(tableOrName, columns) {
939
+ for (const column of columns) {
940
+ await this.dropColumn(tableOrName, column);
941
+ }
942
+ }
943
+ /**
944
+ * Creates a new primary key.
945
+ */
946
+ async createPrimaryKey(tableOrName, columnNames, constraintName) {
947
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
948
+ ? tableOrName
949
+ : await this.getCachedTable(tableOrName);
950
+ const clonedTable = table.clone();
951
+ const up = this.createPrimaryKeySql(table, columnNames, constraintName);
952
+ // mark columns as primary, because dropPrimaryKeySql build constraint name from table primary column names.
953
+ clonedTable.columns.forEach((column) => {
954
+ if (columnNames.find((columnName) => columnName === column.name))
955
+ column.isPrimary = true;
956
+ });
957
+ const down = this.dropPrimaryKeySql(clonedTable);
958
+ await this.executeQueries(up, down);
959
+ this.replaceCachedTable(table, clonedTable);
960
+ }
961
+ /**
962
+ * Updates composite primary keys.
963
+ */
964
+ async updatePrimaryKeys(tableOrName, columns) {
965
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
966
+ ? tableOrName
967
+ : await this.getCachedTable(tableOrName);
968
+ const columnNames = columns.map((column) => column.name);
969
+ const clonedTable = table.clone();
970
+ const upQueries = [];
971
+ const downQueries = [];
972
+ // if table already have primary columns, we must drop them.
973
+ const primaryColumns = clonedTable.primaryColumns;
974
+ if (primaryColumns.length > 0) {
975
+ const pkName = primaryColumns[0].primaryKeyConstraintName
976
+ ? primaryColumns[0].primaryKeyConstraintName
977
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, primaryColumns.map((column) => column.name));
978
+ const columnNamesString = primaryColumns
979
+ .map((column) => `"${column.name}"`)
980
+ .join(", ");
981
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
982
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNamesString})`));
983
+ }
984
+ // update columns in table.
985
+ clonedTable.columns
986
+ .filter((column) => columnNames.indexOf(column.name) !== -1)
987
+ .forEach((column) => (column.isPrimary = true));
988
+ const pkName = primaryColumns[0].primaryKeyConstraintName
989
+ ? primaryColumns[0].primaryKeyConstraintName
990
+ : this.connection.namingStrategy.primaryKeyName(clonedTable, columnNames);
991
+ const columnNamesString = columnNames
992
+ .map((columnName) => `"${columnName}"`)
993
+ .join(", ");
994
+ upQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${pkName}" PRIMARY KEY (${columnNamesString})`));
995
+ downQueries.push(new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${pkName}"`));
996
+ await this.executeQueries(upQueries, downQueries);
997
+ this.replaceCachedTable(table, clonedTable);
998
+ }
999
+ /**
1000
+ * Drops a primary key.
1001
+ */
1002
+ async dropPrimaryKey(tableOrName, constraintName) {
1003
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1004
+ ? tableOrName
1005
+ : await this.getCachedTable(tableOrName);
1006
+ const up = this.dropPrimaryKeySql(table);
1007
+ const down = this.createPrimaryKeySql(table, table.primaryColumns.map((column) => column.name), constraintName);
1008
+ await this.executeQueries(up, down);
1009
+ table.primaryColumns.forEach((column) => {
1010
+ column.isPrimary = false;
1011
+ });
1012
+ }
1013
+ /**
1014
+ * Creates a new unique constraint.
1015
+ */
1016
+ async createUniqueConstraint(tableOrName, uniqueConstraint) {
1017
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1018
+ ? tableOrName
1019
+ : await this.getCachedTable(tableOrName);
1020
+ // new unique constraint may be passed without name. In this case we generate unique name manually.
1021
+ if (!uniqueConstraint.name)
1022
+ uniqueConstraint.name =
1023
+ this.connection.namingStrategy.uniqueConstraintName(table, uniqueConstraint.columnNames);
1024
+ const up = this.createUniqueConstraintSql(table, uniqueConstraint);
1025
+ const down = this.dropUniqueConstraintSql(table, uniqueConstraint);
1026
+ await this.executeQueries(up, down);
1027
+ table.addUniqueConstraint(uniqueConstraint);
1028
+ }
1029
+ /**
1030
+ * Creates a new unique constraints.
1031
+ */
1032
+ async createUniqueConstraints(tableOrName, uniqueConstraints) {
1033
+ const promises = uniqueConstraints.map((uniqueConstraint) => this.createUniqueConstraint(tableOrName, uniqueConstraint));
1034
+ await Promise.all(promises);
1035
+ }
1036
+ /**
1037
+ * Drops an unique constraint.
1038
+ */
1039
+ async dropUniqueConstraint(tableOrName, uniqueOrName) {
1040
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1041
+ ? tableOrName
1042
+ : await this.getCachedTable(tableOrName);
1043
+ const uniqueConstraint = InstanceChecker_1.InstanceChecker.isTableUnique(uniqueOrName)
1044
+ ? uniqueOrName
1045
+ : table.uniques.find((u) => u.name === uniqueOrName);
1046
+ if (!uniqueConstraint)
1047
+ throw new error_1.TypeORMError(`Supplied unique constraint was not found in table ${table.name}`);
1048
+ const up = this.dropUniqueConstraintSql(table, uniqueConstraint);
1049
+ const down = this.createUniqueConstraintSql(table, uniqueConstraint);
1050
+ await this.executeQueries(up, down);
1051
+ table.removeUniqueConstraint(uniqueConstraint);
1052
+ }
1053
+ /**
1054
+ * Creates an unique constraints.
1055
+ */
1056
+ async dropUniqueConstraints(tableOrName, uniqueConstraints) {
1057
+ const promises = uniqueConstraints.map((uniqueConstraint) => this.dropUniqueConstraint(tableOrName, uniqueConstraint));
1058
+ await Promise.all(promises);
1059
+ }
1060
+ /**
1061
+ * Creates new check constraint.
1062
+ */
1063
+ async createCheckConstraint(tableOrName, checkConstraint) {
1064
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1065
+ ? tableOrName
1066
+ : await this.getCachedTable(tableOrName);
1067
+ // new unique constraint may be passed without name. In this case we generate unique name manually.
1068
+ if (!checkConstraint.name)
1069
+ checkConstraint.name =
1070
+ this.connection.namingStrategy.checkConstraintName(table, checkConstraint.expression);
1071
+ const up = this.createCheckConstraintSql(table, checkConstraint);
1072
+ const down = this.dropCheckConstraintSql(table, checkConstraint);
1073
+ await this.executeQueries(up, down);
1074
+ table.addCheckConstraint(checkConstraint);
1075
+ }
1076
+ /**
1077
+ * Creates new check constraints.
1078
+ */
1079
+ async createCheckConstraints(tableOrName, checkConstraints) {
1080
+ const promises = checkConstraints.map((checkConstraint) => this.createCheckConstraint(tableOrName, checkConstraint));
1081
+ await Promise.all(promises);
1082
+ }
1083
+ /**
1084
+ * Drops check constraint.
1085
+ */
1086
+ async dropCheckConstraint(tableOrName, checkOrName) {
1087
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1088
+ ? tableOrName
1089
+ : await this.getCachedTable(tableOrName);
1090
+ const checkConstraint = InstanceChecker_1.InstanceChecker.isTableCheck(checkOrName)
1091
+ ? checkOrName
1092
+ : table.checks.find((c) => c.name === checkOrName);
1093
+ if (!checkConstraint)
1094
+ throw new error_1.TypeORMError(`Supplied check constraint was not found in table ${table.name}`);
1095
+ const up = this.dropCheckConstraintSql(table, checkConstraint);
1096
+ const down = this.createCheckConstraintSql(table, checkConstraint);
1097
+ await this.executeQueries(up, down);
1098
+ table.removeCheckConstraint(checkConstraint);
1099
+ }
1100
+ /**
1101
+ * Drops check constraints.
1102
+ */
1103
+ async dropCheckConstraints(tableOrName, checkConstraints) {
1104
+ const promises = checkConstraints.map((checkConstraint) => this.dropCheckConstraint(tableOrName, checkConstraint));
1105
+ await Promise.all(promises);
1106
+ }
1107
+ /**
1108
+ * Creates a new exclusion constraint.
1109
+ */
1110
+ async createExclusionConstraint(tableOrName, exclusionConstraint) {
1111
+ throw new error_1.TypeORMError(`Oracle does not support exclusion constraints.`);
1112
+ }
1113
+ /**
1114
+ * Creates a new exclusion constraints.
1115
+ */
1116
+ async createExclusionConstraints(tableOrName, exclusionConstraints) {
1117
+ throw new error_1.TypeORMError(`Oracle does not support exclusion constraints.`);
1118
+ }
1119
+ /**
1120
+ * Drops exclusion constraint.
1121
+ */
1122
+ async dropExclusionConstraint(tableOrName, exclusionOrName) {
1123
+ throw new error_1.TypeORMError(`Oracle does not support exclusion constraints.`);
1124
+ }
1125
+ /**
1126
+ * Drops exclusion constraints.
1127
+ */
1128
+ async dropExclusionConstraints(tableOrName, exclusionConstraints) {
1129
+ throw new error_1.TypeORMError(`Oracle does not support exclusion constraints.`);
1130
+ }
1131
+ /**
1132
+ * Creates a new foreign key.
1133
+ */
1134
+ async createForeignKey(tableOrName, foreignKey) {
1135
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1136
+ ? tableOrName
1137
+ : await this.getCachedTable(tableOrName);
1138
+ // new FK may be passed without name. In this case we generate FK name manually.
1139
+ if (!foreignKey.name)
1140
+ foreignKey.name = this.connection.namingStrategy.foreignKeyName(table, foreignKey.columnNames, this.getTablePath(foreignKey), foreignKey.referencedColumnNames);
1141
+ const up = this.createForeignKeySql(table, foreignKey);
1142
+ const down = this.dropForeignKeySql(table, foreignKey);
1143
+ await this.executeQueries(up, down);
1144
+ table.addForeignKey(foreignKey);
1145
+ }
1146
+ /**
1147
+ * Creates a new foreign keys.
1148
+ */
1149
+ async createForeignKeys(tableOrName, foreignKeys) {
1150
+ const promises = foreignKeys.map((foreignKey) => this.createForeignKey(tableOrName, foreignKey));
1151
+ await Promise.all(promises);
1152
+ }
1153
+ /**
1154
+ * Drops a foreign key from the table.
1155
+ */
1156
+ async dropForeignKey(tableOrName, foreignKeyOrName) {
1157
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1158
+ ? tableOrName
1159
+ : await this.getCachedTable(tableOrName);
1160
+ const foreignKey = InstanceChecker_1.InstanceChecker.isTableForeignKey(foreignKeyOrName)
1161
+ ? foreignKeyOrName
1162
+ : table.foreignKeys.find((fk) => fk.name === foreignKeyOrName);
1163
+ if (!foreignKey)
1164
+ throw new error_1.TypeORMError(`Supplied foreign key was not found in table ${table.name}`);
1165
+ const up = this.dropForeignKeySql(table, foreignKey);
1166
+ const down = this.createForeignKeySql(table, foreignKey);
1167
+ await this.executeQueries(up, down);
1168
+ table.removeForeignKey(foreignKey);
1169
+ }
1170
+ /**
1171
+ * Drops a foreign keys from the table.
1172
+ */
1173
+ async dropForeignKeys(tableOrName, foreignKeys) {
1174
+ const promises = foreignKeys.map((foreignKey) => this.dropForeignKey(tableOrName, foreignKey));
1175
+ await Promise.all(promises);
1176
+ }
1177
+ /**
1178
+ * Creates a new index.
1179
+ */
1180
+ async createIndex(tableOrName, index) {
1181
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1182
+ ? tableOrName
1183
+ : await this.getCachedTable(tableOrName);
1184
+ // new index may be passed without name. In this case we generate index name manually.
1185
+ if (!index.name)
1186
+ index.name = this.generateIndexName(table, index);
1187
+ const up = this.createIndexSql(table, index);
1188
+ const down = this.dropIndexSql(index);
1189
+ await this.executeQueries(up, down);
1190
+ table.addIndex(index);
1191
+ }
1192
+ /**
1193
+ * Creates a new indices
1194
+ */
1195
+ async createIndices(tableOrName, indices) {
1196
+ const promises = indices.map((index) => this.createIndex(tableOrName, index));
1197
+ await Promise.all(promises);
1198
+ }
1199
+ /**
1200
+ * Drops an index from the table.
1201
+ */
1202
+ async dropIndex(tableOrName, indexOrName) {
1203
+ const table = InstanceChecker_1.InstanceChecker.isTable(tableOrName)
1204
+ ? tableOrName
1205
+ : await this.getCachedTable(tableOrName);
1206
+ const index = InstanceChecker_1.InstanceChecker.isTableIndex(indexOrName)
1207
+ ? indexOrName
1208
+ : table.indices.find((i) => i.name === indexOrName);
1209
+ if (!index)
1210
+ throw new error_1.TypeORMError(`Supplied index ${indexOrName} was not found in table ${table.name}`);
1211
+ // old index may be passed without name. In this case we generate index name manually.
1212
+ if (!index.name)
1213
+ index.name = this.generateIndexName(table, index);
1214
+ const up = this.dropIndexSql(index);
1215
+ const down = this.createIndexSql(table, index);
1216
+ await this.executeQueries(up, down);
1217
+ table.removeIndex(index);
1218
+ }
1219
+ /**
1220
+ * Drops an indices from the table.
1221
+ */
1222
+ async dropIndices(tableOrName, indices) {
1223
+ const promises = indices.map((index) => this.dropIndex(tableOrName, index));
1224
+ await Promise.all(promises);
1225
+ }
1226
+ /**
1227
+ * Clears all table contents.
1228
+ * Note: this operation uses SQL's TRUNCATE query which cannot be reverted in transactions.
1229
+ */
1230
+ async clearTable(tableName) {
1231
+ await this.query(`TRUNCATE TABLE ${this.escapePath(tableName)}`);
1232
+ }
1233
+ /**
1234
+ * Removes all tables from the currently connected database.
1235
+ */
1236
+ async clearDatabase() {
1237
+ const isAnotherTransactionActive = this.isTransactionActive;
1238
+ if (!isAnotherTransactionActive)
1239
+ await this.startTransaction();
1240
+ try {
1241
+ // drop views
1242
+ const dropViewsQuery = `SELECT 'DROP VIEW "' || VIEW_NAME || '"' AS "query" FROM "USER_VIEWS"`;
1243
+ const dropViewQueries = await this.query(dropViewsQuery);
1244
+ await Promise.all(dropViewQueries.map((query) => this.query(query["query"])));
1245
+ // drop materialized views
1246
+ const dropMatViewsQuery = `SELECT 'DROP MATERIALIZED VIEW "' || MVIEW_NAME || '"' AS "query" FROM "USER_MVIEWS"`;
1247
+ const dropMatViewQueries = await this.query(dropMatViewsQuery);
1248
+ await Promise.all(dropMatViewQueries.map((query) => this.query(query["query"])));
1249
+ // drop tables
1250
+ const dropTablesQuery = `SELECT 'DROP TABLE "' || TABLE_NAME || '" CASCADE CONSTRAINTS' AS "query" FROM "USER_TABLES"`;
1251
+ const dropTableQueries = await this.query(dropTablesQuery);
1252
+ await Promise.all(dropTableQueries.map((query) => this.query(query["query"])));
1253
+ if (!isAnotherTransactionActive)
1254
+ await this.commitTransaction();
1255
+ }
1256
+ catch (error) {
1257
+ try {
1258
+ // we throw original error even if rollback thrown an error
1259
+ if (!isAnotherTransactionActive)
1260
+ await this.rollbackTransaction();
1261
+ }
1262
+ catch (rollbackError) { }
1263
+ throw error;
1264
+ }
1265
+ }
1266
+ // -------------------------------------------------------------------------
1267
+ // Protected Methods
1268
+ // -------------------------------------------------------------------------
1269
+ async loadViews(viewNames) {
1270
+ const hasTable = await this.hasTable(this.getTypeormMetadataTableName());
1271
+ if (!hasTable) {
1272
+ return [];
1273
+ }
1274
+ if (!viewNames) {
1275
+ viewNames = [];
1276
+ }
1277
+ const currentDatabase = await this.getCurrentDatabase();
1278
+ const currentSchema = await this.getCurrentSchema();
1279
+ const viewsCondition = viewNames
1280
+ .map((viewName) => this.driver.parseTableName(viewName))
1281
+ .map(({ schema, tableName }) => {
1282
+ if (!schema) {
1283
+ schema = this.driver.options.schema || currentSchema;
1284
+ }
1285
+ return `("T"."schema" = '${schema}' AND "T"."name" = '${tableName}')`;
1286
+ })
1287
+ .join(" OR ");
1288
+ let query = `SELECT "T".* FROM ${this.escapePath(this.getTypeormMetadataTableName())} "T" ` +
1289
+ `INNER JOIN "USER_OBJECTS" "O" ON "O"."OBJECT_NAME" = "T"."name" AND "O"."OBJECT_TYPE" IN ( 'MATERIALIZED VIEW', 'VIEW' ) ` +
1290
+ `WHERE "T"."type" IN ('${MetadataTableType_1.MetadataTableType.MATERIALIZED_VIEW}', '${MetadataTableType_1.MetadataTableType.VIEW}')`;
1291
+ if (viewsCondition.length > 0)
1292
+ query += ` AND ${viewsCondition}`;
1293
+ const dbViews = await this.query(query);
1294
+ return dbViews.map((dbView) => {
1295
+ const parsedName = this.driver.parseTableName(dbView["name"]);
1296
+ const view = new View_1.View();
1297
+ view.database =
1298
+ parsedName.database || dbView["database"] || currentDatabase;
1299
+ view.schema = parsedName.schema || dbView["schema"] || currentSchema;
1300
+ view.name = parsedName.tableName;
1301
+ view.expression = dbView["value"];
1302
+ view.materialized =
1303
+ dbView["type"] === MetadataTableType_1.MetadataTableType.MATERIALIZED_VIEW;
1304
+ return view;
1305
+ });
1306
+ }
1307
+ /**
1308
+ * Loads all tables (with given names) from the database and creates a Table from them.
1309
+ */
1310
+ async loadTables(tableNames) {
1311
+ if (tableNames && tableNames.length === 0) {
1312
+ return [];
1313
+ }
1314
+ const dbTables = [];
1315
+ const currentSchema = await this.getCurrentSchema();
1316
+ const currentDatabase = await this.getCurrentDatabase();
1317
+ if (!tableNames) {
1318
+ const tablesSql = `SELECT "TABLE_NAME", "OWNER" FROM "ALL_TABLES"`;
1319
+ dbTables.push(...(await this.query(tablesSql)));
1320
+ }
1321
+ else {
1322
+ const tablesCondition = tableNames
1323
+ .map((tableName) => {
1324
+ const parts = tableName.split(".");
1325
+ if (parts.length >= 3) {
1326
+ const [, schema, name] = parts;
1327
+ return `("OWNER" = '${schema}' AND "TABLE_NAME" = '${name}')`;
1328
+ }
1329
+ else if (parts.length === 2) {
1330
+ const [schema, name] = parts;
1331
+ return `("OWNER" = '${schema}' AND "TABLE_NAME" = '${name}')`;
1332
+ }
1333
+ else if (parts.length === 1) {
1334
+ const [name] = parts;
1335
+ return `("TABLE_NAME" = '${name}')`;
1336
+ }
1337
+ else {
1338
+ return `(1=0)`;
1339
+ }
1340
+ })
1341
+ .join(" OR ");
1342
+ const tablesSql = `SELECT "TABLE_NAME", "OWNER" FROM "ALL_TABLES" WHERE ${tablesCondition}`;
1343
+ dbTables.push(...(await this.query(tablesSql)));
1344
+ }
1345
+ // if tables were not found in the db, no need to proceed
1346
+ if (dbTables.length === 0) {
1347
+ return [];
1348
+ }
1349
+ // load tables, columns, indices and foreign keys
1350
+ const columnsCondition = dbTables
1351
+ .map(({ TABLE_NAME, OWNER }) => {
1352
+ return `("C"."OWNER" = '${OWNER}' AND "C"."TABLE_NAME" = '${TABLE_NAME}')`;
1353
+ })
1354
+ .join(" OR ");
1355
+ const columnsSql = `SELECT * FROM "ALL_TAB_COLS" "C" WHERE (${columnsCondition})`;
1356
+ const indicesSql = `SELECT "C"."INDEX_NAME", "C"."OWNER", "C"."TABLE_NAME", "C"."UNIQUENESS", ` +
1357
+ `LISTAGG ("COL"."COLUMN_NAME", ',') WITHIN GROUP (ORDER BY "COL"."COLUMN_NAME") AS "COLUMN_NAMES" ` +
1358
+ `FROM "ALL_INDEXES" "C" ` +
1359
+ `INNER JOIN "ALL_IND_COLUMNS" "COL" ON "COL"."INDEX_OWNER" = "C"."OWNER" AND "COL"."INDEX_NAME" = "C"."INDEX_NAME" ` +
1360
+ `LEFT JOIN "ALL_CONSTRAINTS" "CON" ON "CON"."OWNER" = "C"."OWNER" AND "CON"."CONSTRAINT_NAME" = "C"."INDEX_NAME" ` +
1361
+ `WHERE (${columnsCondition}) AND "CON"."CONSTRAINT_NAME" IS NULL ` +
1362
+ `GROUP BY "C"."INDEX_NAME", "C"."OWNER", "C"."TABLE_NAME", "C"."UNIQUENESS"`;
1363
+ const foreignKeysSql = `SELECT "C"."CONSTRAINT_NAME", "C"."OWNER", "C"."TABLE_NAME", "COL"."COLUMN_NAME", "REF_COL"."TABLE_NAME" AS "REFERENCED_TABLE_NAME", ` +
1364
+ `"REF_COL"."COLUMN_NAME" AS "REFERENCED_COLUMN_NAME", "C"."DELETE_RULE" AS "ON_DELETE" ` +
1365
+ `FROM "ALL_CONSTRAINTS" "C" ` +
1366
+ `INNER JOIN "ALL_CONS_COLUMNS" "COL" ON "COL"."OWNER" = "C"."OWNER" AND "COL"."CONSTRAINT_NAME" = "C"."CONSTRAINT_NAME" ` +
1367
+ `INNER JOIN "ALL_CONS_COLUMNS" "REF_COL" ON "REF_COL"."OWNER" = "C"."R_OWNER" AND "REF_COL"."CONSTRAINT_NAME" = "C"."R_CONSTRAINT_NAME" AND "REF_COL"."POSITION" = "COL"."POSITION" ` +
1368
+ `WHERE (${columnsCondition}) AND "C"."CONSTRAINT_TYPE" = 'R'`;
1369
+ const constraintsSql = `SELECT "C"."CONSTRAINT_NAME", "C"."CONSTRAINT_TYPE", "C"."OWNER", "C"."TABLE_NAME", "COL"."COLUMN_NAME", "C"."SEARCH_CONDITION" ` +
1370
+ `FROM "ALL_CONSTRAINTS" "C" ` +
1371
+ `INNER JOIN "ALL_CONS_COLUMNS" "COL" ON "COL"."OWNER" = "C"."OWNER" AND "COL"."CONSTRAINT_NAME" = "C"."CONSTRAINT_NAME" ` +
1372
+ `WHERE (${columnsCondition}) AND "C"."CONSTRAINT_TYPE" IN ('C', 'U', 'P') AND "C"."GENERATED" = 'USER NAME'`;
1373
+ const [dbColumns, dbIndices, dbForeignKeys, dbConstraints,] = await Promise.all([
1374
+ this.query(columnsSql),
1375
+ this.query(indicesSql),
1376
+ this.query(foreignKeysSql),
1377
+ this.query(constraintsSql),
1378
+ ]);
1379
+ // create tables for loaded tables
1380
+ return await Promise.all(dbTables.map(async (dbTable) => {
1381
+ const table = new Table_1.Table();
1382
+ const owner = dbTable["OWNER"] === currentSchema &&
1383
+ (!this.driver.options.schema ||
1384
+ this.driver.options.schema === currentSchema)
1385
+ ? undefined
1386
+ : dbTable["OWNER"];
1387
+ table.database = currentDatabase;
1388
+ table.schema = dbTable["OWNER"];
1389
+ table.name = this.driver.buildTableName(dbTable["TABLE_NAME"], owner);
1390
+ // create columns from the loaded columns
1391
+ table.columns = await Promise.all(dbColumns
1392
+ .filter((dbColumn) => dbColumn["OWNER"] === dbTable["OWNER"] &&
1393
+ dbColumn["TABLE_NAME"] ===
1394
+ dbTable["TABLE_NAME"] &&
1395
+ // Filter out auto-generated virtual columns,
1396
+ // since TypeORM will have no info about them.
1397
+ !(dbColumn["VIRTUAL_COLUMN"] === "YES" &&
1398
+ dbColumn["USER_GENERATED"] === "NO"))
1399
+ .map(async (dbColumn) => {
1400
+ const columnConstraints = dbConstraints.filter((dbConstraint) => dbConstraint["OWNER"] ===
1401
+ dbColumn["OWNER"] &&
1402
+ dbConstraint["TABLE_NAME"] ===
1403
+ dbColumn["TABLE_NAME"] &&
1404
+ dbConstraint["COLUMN_NAME"] ===
1405
+ dbColumn["COLUMN_NAME"]);
1406
+ const uniqueConstraints = columnConstraints.filter((constraint) => constraint["CONSTRAINT_TYPE"] === "U");
1407
+ const isConstraintComposite = uniqueConstraints.every((uniqueConstraint) => {
1408
+ return dbConstraints.some((dbConstraint) => dbConstraint["OWNER"] ===
1409
+ dbColumn["OWNER"] &&
1410
+ dbConstraint["TABLE_NAME"] ===
1411
+ dbColumn["TABLE_NAME"] &&
1412
+ dbConstraint["COLUMN_NAME"] !==
1413
+ dbColumn["COLUMN_NAME"] &&
1414
+ dbConstraint["CONSTRAINT_NAME"] ===
1415
+ uniqueConstraint["CONSTRAINT_NAME"] &&
1416
+ dbConstraint["CONSTRAINT_TYPE"] ===
1417
+ "U");
1418
+ });
1419
+ const tableColumn = new TableColumn_1.TableColumn();
1420
+ tableColumn.name = dbColumn["COLUMN_NAME"];
1421
+ tableColumn.type =
1422
+ dbColumn["DATA_TYPE"].toLowerCase();
1423
+ if (tableColumn.type.indexOf("(") !== -1)
1424
+ tableColumn.type = tableColumn.type.replace(/\([0-9]*\)/, "");
1425
+ // check only columns that have length property
1426
+ if (this.driver.withLengthColumnTypes.indexOf(tableColumn.type) !== -1) {
1427
+ const length = tableColumn.type === "raw"
1428
+ ? dbColumn["DATA_LENGTH"]
1429
+ : dbColumn["CHAR_COL_DECL_LENGTH"];
1430
+ tableColumn.length =
1431
+ length &&
1432
+ !this.isDefaultColumnLength(table, tableColumn, length)
1433
+ ? length.toString()
1434
+ : "";
1435
+ }
1436
+ if (tableColumn.type === "number" ||
1437
+ tableColumn.type === "float") {
1438
+ if (dbColumn["DATA_PRECISION"] !== null &&
1439
+ !this.isDefaultColumnPrecision(table, tableColumn, dbColumn["DATA_PRECISION"]))
1440
+ tableColumn.precision =
1441
+ dbColumn["DATA_PRECISION"];
1442
+ if (dbColumn["DATA_SCALE"] !== null &&
1443
+ !this.isDefaultColumnScale(table, tableColumn, dbColumn["DATA_SCALE"]))
1444
+ tableColumn.scale = dbColumn["DATA_SCALE"];
1445
+ }
1446
+ else if ((tableColumn.type === "timestamp" ||
1447
+ tableColumn.type ===
1448
+ "timestamp with time zone" ||
1449
+ tableColumn.type ===
1450
+ "timestamp with local time zone") &&
1451
+ dbColumn["DATA_SCALE"] !== null) {
1452
+ tableColumn.precision =
1453
+ !this.isDefaultColumnPrecision(table, tableColumn, dbColumn["DATA_SCALE"])
1454
+ ? dbColumn["DATA_SCALE"]
1455
+ : undefined;
1456
+ }
1457
+ tableColumn.default =
1458
+ dbColumn["DATA_DEFAULT"] !== null &&
1459
+ dbColumn["DATA_DEFAULT"] !== undefined &&
1460
+ dbColumn["VIRTUAL_COLUMN"] === "NO" &&
1461
+ dbColumn["DATA_DEFAULT"].trim() !== "NULL"
1462
+ ? (tableColumn.default =
1463
+ dbColumn["DATA_DEFAULT"].trim())
1464
+ : undefined;
1465
+ const primaryConstraint = columnConstraints.find((constraint) => constraint["CONSTRAINT_TYPE"] === "P");
1466
+ if (primaryConstraint) {
1467
+ tableColumn.isPrimary = true;
1468
+ // find another columns involved in primary key constraint
1469
+ const anotherPrimaryConstraints = dbConstraints.filter((constraint) => constraint["OWNER"] ===
1470
+ dbColumn["OWNER"] &&
1471
+ constraint["TABLE_NAME"] ===
1472
+ dbColumn["TABLE_NAME"] &&
1473
+ constraint["COLUMN_NAME"] !==
1474
+ dbColumn["COLUMN_NAME"] &&
1475
+ constraint["CONSTRAINT_TYPE"] ===
1476
+ "P");
1477
+ // collect all column names
1478
+ const columnNames = anotherPrimaryConstraints.map((constraint) => constraint["COLUMN_NAME"]);
1479
+ columnNames.push(dbColumn["COLUMN_NAME"]);
1480
+ // build default primary key constraint name
1481
+ const pkName = this.connection.namingStrategy.primaryKeyName(table, columnNames);
1482
+ // if primary key has user-defined constraint name, write it in table column
1483
+ if (primaryConstraint["CONSTRAINT_NAME"] !==
1484
+ pkName) {
1485
+ tableColumn.primaryKeyConstraintName =
1486
+ primaryConstraint["CONSTRAINT_NAME"];
1487
+ }
1488
+ }
1489
+ tableColumn.isNullable =
1490
+ dbColumn["NULLABLE"] === "Y";
1491
+ tableColumn.isUnique =
1492
+ uniqueConstraints.length > 0 &&
1493
+ !isConstraintComposite;
1494
+ tableColumn.isGenerated =
1495
+ dbColumn["IDENTITY_COLUMN"] === "YES";
1496
+ if (tableColumn.isGenerated) {
1497
+ tableColumn.generationStrategy = "increment";
1498
+ tableColumn.default = undefined;
1499
+ }
1500
+ tableColumn.comment = ""; // todo
1501
+ if (dbColumn["VIRTUAL_COLUMN"] === "YES") {
1502
+ tableColumn.generatedType = "VIRTUAL";
1503
+ const asExpressionQuery = this.selectTypeormMetadataSql({
1504
+ table: dbTable["TABLE_NAME"],
1505
+ type: MetadataTableType_1.MetadataTableType.GENERATED_COLUMN,
1506
+ name: tableColumn.name,
1507
+ });
1508
+ const results = await this.query(asExpressionQuery.query, asExpressionQuery.parameters);
1509
+ if (results[0] && results[0].value) {
1510
+ tableColumn.asExpression = results[0].value;
1511
+ }
1512
+ else {
1513
+ tableColumn.asExpression = "";
1514
+ }
1515
+ }
1516
+ return tableColumn;
1517
+ }));
1518
+ // find unique constraints of table, group them by constraint name and build TableUnique.
1519
+ const tableUniqueConstraints = OrmUtils_1.OrmUtils.uniq(dbConstraints.filter((dbConstraint) => {
1520
+ return (dbConstraint["TABLE_NAME"] ===
1521
+ dbTable["TABLE_NAME"] &&
1522
+ dbConstraint["OWNER"] === dbTable["OWNER"] &&
1523
+ dbConstraint["CONSTRAINT_TYPE"] === "U");
1524
+ }), (dbConstraint) => dbConstraint["CONSTRAINT_NAME"]);
1525
+ table.uniques = tableUniqueConstraints.map((constraint) => {
1526
+ const uniques = dbConstraints.filter((dbC) => dbC["CONSTRAINT_NAME"] ===
1527
+ constraint["CONSTRAINT_NAME"]);
1528
+ return new TableUnique_1.TableUnique({
1529
+ name: constraint["CONSTRAINT_NAME"],
1530
+ columnNames: uniques.map((u) => u["COLUMN_NAME"]),
1531
+ });
1532
+ });
1533
+ // find check constraints of table, group them by constraint name and build TableCheck.
1534
+ const tableCheckConstraints = OrmUtils_1.OrmUtils.uniq(dbConstraints.filter((dbConstraint) => {
1535
+ return (dbConstraint["TABLE_NAME"] ===
1536
+ dbTable["TABLE_NAME"] &&
1537
+ dbConstraint["OWNER"] === dbTable["OWNER"] &&
1538
+ dbConstraint["CONSTRAINT_TYPE"] === "C");
1539
+ }), (dbConstraint) => dbConstraint["CONSTRAINT_NAME"]);
1540
+ table.checks = tableCheckConstraints.map((constraint) => {
1541
+ const checks = dbConstraints.filter((dbC) => dbC["TABLE_NAME"] === constraint["TABLE_NAME"] &&
1542
+ dbC["OWNER"] === constraint["OWNER"] &&
1543
+ dbC["CONSTRAINT_NAME"] ===
1544
+ constraint["CONSTRAINT_NAME"]);
1545
+ return new TableCheck_1.TableCheck({
1546
+ name: constraint["CONSTRAINT_NAME"],
1547
+ columnNames: checks.map((c) => c["COLUMN_NAME"]),
1548
+ expression: constraint["SEARCH_CONDITION"],
1549
+ });
1550
+ });
1551
+ // find foreign key constraints of table, group them by constraint name and build TableForeignKey.
1552
+ const tableForeignKeyConstraints = OrmUtils_1.OrmUtils.uniq(dbForeignKeys.filter((dbForeignKey) => dbForeignKey["OWNER"] === dbTable["OWNER"] &&
1553
+ dbForeignKey["TABLE_NAME"] ===
1554
+ dbTable["TABLE_NAME"]), (dbForeignKey) => dbForeignKey["CONSTRAINT_NAME"]);
1555
+ table.foreignKeys = tableForeignKeyConstraints.map((dbForeignKey) => {
1556
+ const foreignKeys = dbForeignKeys.filter((dbFk) => dbFk["TABLE_NAME"] ===
1557
+ dbForeignKey["TABLE_NAME"] &&
1558
+ dbFk["OWNER"] === dbForeignKey["OWNER"] &&
1559
+ dbFk["CONSTRAINT_NAME"] ===
1560
+ dbForeignKey["CONSTRAINT_NAME"]);
1561
+ return new TableForeignKey_1.TableForeignKey({
1562
+ name: dbForeignKey["CONSTRAINT_NAME"],
1563
+ columnNames: foreignKeys.map((dbFk) => dbFk["COLUMN_NAME"]),
1564
+ referencedDatabase: table.database,
1565
+ referencedSchema: dbForeignKey["OWNER"],
1566
+ referencedTableName: dbForeignKey["REFERENCED_TABLE_NAME"],
1567
+ referencedColumnNames: foreignKeys.map((dbFk) => dbFk["REFERENCED_COLUMN_NAME"]),
1568
+ onDelete: dbForeignKey["ON_DELETE"],
1569
+ onUpdate: "NO ACTION", // Oracle does not have onUpdate option in FK's, but we need it for proper synchronization
1570
+ });
1571
+ });
1572
+ // Attempt to map auto-generated virtual columns to their
1573
+ // referenced columns, through its 'DATA_DEFAULT' property.
1574
+ //
1575
+ // An example of this happening is when a column of type
1576
+ // TIMESTAMP WITH TIME ZONE is indexed. Oracle will create a
1577
+ // virtual column of type TIMESTAMP with a default value of
1578
+ // SYS_EXTRACT_UTC(<column>).
1579
+ const autoGenVirtualDbColumns = dbColumns
1580
+ .filter((dbColumn) => dbColumn["OWNER"] === dbTable["OWNER"] &&
1581
+ dbColumn["TABLE_NAME"] === dbTable["TABLE_NAME"] &&
1582
+ dbColumn["VIRTUAL_COLUMN"] === "YES" &&
1583
+ dbColumn["USER_GENERATED"] === "NO")
1584
+ .reduce((acc, x) => {
1585
+ const referencedDbColumn = dbColumns.find((dbColumn) => x["DATA_DEFAULT"].includes(dbColumn["COLUMN_NAME"]));
1586
+ if (!referencedDbColumn)
1587
+ return acc;
1588
+ return {
1589
+ ...acc,
1590
+ [x["COLUMN_NAME"]]: referencedDbColumn["COLUMN_NAME"],
1591
+ };
1592
+ }, {});
1593
+ // create TableIndex objects from the loaded indices
1594
+ table.indices = dbIndices
1595
+ .filter((dbIndex) => dbIndex["TABLE_NAME"] === dbTable["TABLE_NAME"] &&
1596
+ dbIndex["OWNER"] === dbTable["OWNER"])
1597
+ .map((dbIndex) => {
1598
+ //
1599
+ const columnNames = dbIndex["COLUMN_NAMES"]
1600
+ .split(",")
1601
+ .map((columnName) => autoGenVirtualDbColumns[columnName] ??
1602
+ columnName);
1603
+ return new TableIndex_1.TableIndex({
1604
+ name: dbIndex["INDEX_NAME"],
1605
+ columnNames,
1606
+ isUnique: dbIndex["UNIQUENESS"] === "UNIQUE",
1607
+ });
1608
+ });
1609
+ return table;
1610
+ }));
1611
+ }
1612
+ /**
1613
+ * Builds and returns SQL for create table.
1614
+ */
1615
+ createTableSql(table, createForeignKeys) {
1616
+ const columnDefinitions = table.columns
1617
+ .map((column) => this.buildCreateColumnSql(column))
1618
+ .join(", ");
1619
+ let sql = `CREATE TABLE ${this.escapePath(table)} (${columnDefinitions}`;
1620
+ table.columns
1621
+ .filter((column) => column.isUnique)
1622
+ .forEach((column) => {
1623
+ const isUniqueExist = table.uniques.some((unique) => unique.columnNames.length === 1 &&
1624
+ unique.columnNames[0] === column.name);
1625
+ if (!isUniqueExist)
1626
+ table.uniques.push(new TableUnique_1.TableUnique({
1627
+ name: this.connection.namingStrategy.uniqueConstraintName(table, [column.name]),
1628
+ columnNames: [column.name],
1629
+ }));
1630
+ });
1631
+ if (table.uniques.length > 0) {
1632
+ const uniquesSql = table.uniques
1633
+ .map((unique) => {
1634
+ const uniqueName = unique.name
1635
+ ? unique.name
1636
+ : this.connection.namingStrategy.uniqueConstraintName(table, unique.columnNames);
1637
+ const columnNames = unique.columnNames
1638
+ .map((columnName) => `"${columnName}"`)
1639
+ .join(", ");
1640
+ return `CONSTRAINT "${uniqueName}" UNIQUE (${columnNames})`;
1641
+ })
1642
+ .join(", ");
1643
+ sql += `, ${uniquesSql}`;
1644
+ }
1645
+ if (table.checks.length > 0) {
1646
+ const checksSql = table.checks
1647
+ .map((check) => {
1648
+ const checkName = check.name
1649
+ ? check.name
1650
+ : this.connection.namingStrategy.checkConstraintName(table, check.expression);
1651
+ return `CONSTRAINT "${checkName}" CHECK (${check.expression})`;
1652
+ })
1653
+ .join(", ");
1654
+ sql += `, ${checksSql}`;
1655
+ }
1656
+ if (table.foreignKeys.length > 0 && createForeignKeys) {
1657
+ const foreignKeysSql = table.foreignKeys
1658
+ .map((fk) => {
1659
+ const columnNames = fk.columnNames
1660
+ .map((columnName) => `"${columnName}"`)
1661
+ .join(", ");
1662
+ if (!fk.name)
1663
+ fk.name = this.connection.namingStrategy.foreignKeyName(table, fk.columnNames, this.getTablePath(fk), fk.referencedColumnNames);
1664
+ const referencedColumnNames = fk.referencedColumnNames
1665
+ .map((columnName) => `"${columnName}"`)
1666
+ .join(", ");
1667
+ let constraint = `CONSTRAINT "${fk.name}" FOREIGN KEY (${columnNames}) REFERENCES ${this.escapePath(this.getTablePath(fk))} (${referencedColumnNames})`;
1668
+ if (fk.onDelete && fk.onDelete !== "NO ACTION") {
1669
+ // Oracle does not support NO ACTION, but we set NO ACTION by default in EntityMetadata
1670
+ constraint += ` ON DELETE ${fk.onDelete}`;
1671
+ }
1672
+ return constraint;
1673
+ })
1674
+ .join(", ");
1675
+ sql += `, ${foreignKeysSql}`;
1676
+ }
1677
+ const primaryColumns = table.columns.filter((column) => column.isPrimary);
1678
+ if (primaryColumns.length > 0) {
1679
+ const primaryKeyName = primaryColumns[0].primaryKeyConstraintName
1680
+ ? primaryColumns[0].primaryKeyConstraintName
1681
+ : this.connection.namingStrategy.primaryKeyName(table, primaryColumns.map((column) => column.name));
1682
+ const columnNames = primaryColumns
1683
+ .map((column) => `"${column.name}"`)
1684
+ .join(", ");
1685
+ sql += `, CONSTRAINT "${primaryKeyName}" PRIMARY KEY (${columnNames})`;
1686
+ }
1687
+ sql += `)`;
1688
+ return new Query_1.Query(sql);
1689
+ }
1690
+ /**
1691
+ * Builds drop table sql.
1692
+ */
1693
+ dropTableSql(tableOrName, ifExist) {
1694
+ const query = ifExist
1695
+ ? `DROP TABLE IF EXISTS ${this.escapePath(tableOrName)}`
1696
+ : `DROP TABLE ${this.escapePath(tableOrName)}`;
1697
+ return new Query_1.Query(query);
1698
+ }
1699
+ createViewSql(view) {
1700
+ const materializedClause = view.materialized ? "MATERIALIZED " : "";
1701
+ if (typeof view.expression === "string") {
1702
+ return new Query_1.Query(`CREATE ${materializedClause}VIEW ${this.escapePath(view)} AS ${view.expression}`);
1703
+ }
1704
+ else {
1705
+ return new Query_1.Query(`CREATE ${materializedClause}VIEW ${this.escapePath(view)} AS ${view.expression(this.connection).getQuery()}`);
1706
+ }
1707
+ }
1708
+ insertViewDefinitionSql(view) {
1709
+ const expression = typeof view.expression === "string"
1710
+ ? view.expression.trim()
1711
+ : view.expression(this.connection).getQuery();
1712
+ const type = view.materialized
1713
+ ? MetadataTableType_1.MetadataTableType.MATERIALIZED_VIEW
1714
+ : MetadataTableType_1.MetadataTableType.VIEW;
1715
+ const { schema, tableName } = this.driver.parseTableName(view);
1716
+ return this.insertTypeormMetadataSql({
1717
+ type: type,
1718
+ name: tableName,
1719
+ schema: schema,
1720
+ value: expression,
1721
+ });
1722
+ }
1723
+ /**
1724
+ * Builds drop view sql.
1725
+ */
1726
+ dropViewSql(view) {
1727
+ const materializedClause = view.materialized ? "MATERIALIZED " : "";
1728
+ return new Query_1.Query(`DROP ${materializedClause}VIEW ${this.escapePath(view)}`);
1729
+ }
1730
+ /**
1731
+ * Builds remove view sql.
1732
+ */
1733
+ deleteViewDefinitionSql(view) {
1734
+ const type = view.materialized
1735
+ ? MetadataTableType_1.MetadataTableType.MATERIALIZED_VIEW
1736
+ : MetadataTableType_1.MetadataTableType.VIEW;
1737
+ return this.deleteTypeormMetadataSql({ type, name: view.name });
1738
+ }
1739
+ /**
1740
+ * Builds create index sql.
1741
+ */
1742
+ createIndexSql(table, index) {
1743
+ const columns = index.columnNames
1744
+ .map((columnName) => `"${columnName}"`)
1745
+ .join(", ");
1746
+ return new Query_1.Query(`CREATE ${index.isUnique ? "UNIQUE " : ""}INDEX "${index.name}" ON ${this.escapePath(table)} (${columns})`);
1747
+ }
1748
+ /**
1749
+ * Builds drop index sql.
1750
+ */
1751
+ dropIndexSql(indexOrName) {
1752
+ const indexName = InstanceChecker_1.InstanceChecker.isTableIndex(indexOrName)
1753
+ ? indexOrName.name
1754
+ : indexOrName;
1755
+ return new Query_1.Query(`DROP INDEX "${indexName}"`);
1756
+ }
1757
+ /**
1758
+ * Builds create primary key sql.
1759
+ */
1760
+ createPrimaryKeySql(table, columnNames, constraintName) {
1761
+ const primaryKeyName = constraintName
1762
+ ? constraintName
1763
+ : this.connection.namingStrategy.primaryKeyName(table, columnNames);
1764
+ const columnNamesString = columnNames
1765
+ .map((columnName) => `"${columnName}"`)
1766
+ .join(", ");
1767
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${primaryKeyName}" PRIMARY KEY (${columnNamesString})`);
1768
+ }
1769
+ /**
1770
+ * Builds drop primary key sql.
1771
+ */
1772
+ dropPrimaryKeySql(table) {
1773
+ if (!table.primaryColumns.length)
1774
+ throw new error_1.TypeORMError(`Table ${table} has no primary keys.`);
1775
+ const columnNames = table.primaryColumns.map((column) => column.name);
1776
+ const constraintName = table.primaryColumns[0].primaryKeyConstraintName;
1777
+ const primaryKeyName = constraintName
1778
+ ? constraintName
1779
+ : this.connection.namingStrategy.primaryKeyName(table, columnNames);
1780
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${primaryKeyName}"`);
1781
+ }
1782
+ /**
1783
+ * Builds create unique constraint sql.
1784
+ */
1785
+ createUniqueConstraintSql(table, uniqueConstraint) {
1786
+ const columnNames = uniqueConstraint.columnNames
1787
+ .map((column) => `"` + column + `"`)
1788
+ .join(", ");
1789
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${uniqueConstraint.name}" UNIQUE (${columnNames})`);
1790
+ }
1791
+ /**
1792
+ * Builds drop unique constraint sql.
1793
+ */
1794
+ dropUniqueConstraintSql(table, uniqueOrName) {
1795
+ const uniqueName = InstanceChecker_1.InstanceChecker.isTableUnique(uniqueOrName)
1796
+ ? uniqueOrName.name
1797
+ : uniqueOrName;
1798
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${uniqueName}"`);
1799
+ }
1800
+ /**
1801
+ * Builds create check constraint sql.
1802
+ */
1803
+ createCheckConstraintSql(table, checkConstraint) {
1804
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${checkConstraint.name}" CHECK (${checkConstraint.expression})`);
1805
+ }
1806
+ /**
1807
+ * Builds drop check constraint sql.
1808
+ */
1809
+ dropCheckConstraintSql(table, checkOrName) {
1810
+ const checkName = InstanceChecker_1.InstanceChecker.isTableCheck(checkOrName)
1811
+ ? checkOrName.name
1812
+ : checkOrName;
1813
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${checkName}"`);
1814
+ }
1815
+ /**
1816
+ * Builds create foreign key sql.
1817
+ */
1818
+ createForeignKeySql(table, foreignKey) {
1819
+ const columnNames = foreignKey.columnNames
1820
+ .map((column) => `"` + column + `"`)
1821
+ .join(", ");
1822
+ const referencedColumnNames = foreignKey.referencedColumnNames
1823
+ .map((column) => `"` + column + `"`)
1824
+ .join(",");
1825
+ let sql = `ALTER TABLE ${this.escapePath(table)} ADD CONSTRAINT "${foreignKey.name}" FOREIGN KEY (${columnNames}) ` +
1826
+ `REFERENCES ${this.escapePath(this.getTablePath(foreignKey))} (${referencedColumnNames})`;
1827
+ // Oracle does not support NO ACTION, but we set NO ACTION by default in EntityMetadata
1828
+ if (foreignKey.onDelete && foreignKey.onDelete !== "NO ACTION") {
1829
+ sql += ` ON DELETE ${foreignKey.onDelete}`;
1830
+ }
1831
+ return new Query_1.Query(sql);
1832
+ }
1833
+ /**
1834
+ * Builds drop foreign key sql.
1835
+ */
1836
+ dropForeignKeySql(table, foreignKeyOrName) {
1837
+ const foreignKeyName = InstanceChecker_1.InstanceChecker.isTableForeignKey(foreignKeyOrName)
1838
+ ? foreignKeyOrName.name
1839
+ : foreignKeyOrName;
1840
+ return new Query_1.Query(`ALTER TABLE ${this.escapePath(table)} DROP CONSTRAINT "${foreignKeyName}"`);
1841
+ }
1842
+ /**
1843
+ * Builds a query for create column.
1844
+ */
1845
+ buildCreateColumnSql(column) {
1846
+ let c = `"${column.name}" ` + this.connection.driver.createFullType(column);
1847
+ if (column.charset)
1848
+ c += " CHARACTER SET " + column.charset;
1849
+ if (column.collation)
1850
+ c += " COLLATE " + column.collation;
1851
+ if (column.asExpression)
1852
+ c += ` AS (${column.asExpression}) VIRTUAL`;
1853
+ if (column.default !== undefined && column.default !== null)
1854
+ // DEFAULT must be placed before NOT NULL
1855
+ c += " DEFAULT " + column.default;
1856
+ if (column.isNullable !== true && !column.isGenerated)
1857
+ // NOT NULL is not supported with GENERATED
1858
+ c += " NOT NULL";
1859
+ if (column.isGenerated === true &&
1860
+ column.generationStrategy === "increment")
1861
+ c += " GENERATED BY DEFAULT AS IDENTITY";
1862
+ return c;
1863
+ }
1864
+ /**
1865
+ * Escapes given table or view path.
1866
+ */
1867
+ escapePath(target) {
1868
+ // Ignore database when escaping paths
1869
+ const { schema, tableName } = this.driver.parseTableName(target);
1870
+ if (schema && schema !== this.driver.schema) {
1871
+ return `"${schema}"."${tableName}"`;
1872
+ }
1873
+ return `"${tableName}"`;
1874
+ }
1875
+ /**
1876
+ * Change table comment.
1877
+ */
1878
+ changeTableComment(tableOrName, comment) {
1879
+ throw new error_1.TypeORMError(`oracle driver does not support change table comment.`);
1880
+ }
1881
+ }
1882
+ exports.OracleQueryRunner = OracleQueryRunner;
1883
+
1884
+ //# sourceMappingURL=OracleQueryRunner.js.map