@lakutata/orm 0.0.0-stage → 3.0.0-beta.0

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 (209) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +463 -2
  3. package/THIRD_PARTY_NOTICES.md +36 -0
  4. package/dist/cjs/components/Database.d.ts +333 -0
  5. package/dist/cjs/components/Database.js +381 -0
  6. package/dist/cjs/decorators/orm/AfterInsert.d.ts +1 -0
  7. package/dist/cjs/decorators/orm/AfterInsert.js +5 -0
  8. package/dist/cjs/decorators/orm/AfterLoad.d.ts +1 -0
  9. package/dist/cjs/decorators/orm/AfterLoad.js +5 -0
  10. package/dist/cjs/decorators/orm/AfterRecover.d.ts +1 -0
  11. package/dist/cjs/decorators/orm/AfterRecover.js +5 -0
  12. package/dist/cjs/decorators/orm/AfterRemove.d.ts +1 -0
  13. package/dist/cjs/decorators/orm/AfterRemove.js +5 -0
  14. package/dist/cjs/decorators/orm/AfterSoftRemove.d.ts +1 -0
  15. package/dist/cjs/decorators/orm/AfterSoftRemove.js +5 -0
  16. package/dist/cjs/decorators/orm/AfterUpdate.d.ts +1 -0
  17. package/dist/cjs/decorators/orm/AfterUpdate.js +5 -0
  18. package/dist/cjs/decorators/orm/BeforeInsert.d.ts +1 -0
  19. package/dist/cjs/decorators/orm/BeforeInsert.js +5 -0
  20. package/dist/cjs/decorators/orm/BeforeRecover.d.ts +1 -0
  21. package/dist/cjs/decorators/orm/BeforeRecover.js +5 -0
  22. package/dist/cjs/decorators/orm/BeforeRemove.d.ts +1 -0
  23. package/dist/cjs/decorators/orm/BeforeRemove.js +5 -0
  24. package/dist/cjs/decorators/orm/BeforeSoftRemove.d.ts +1 -0
  25. package/dist/cjs/decorators/orm/BeforeSoftRemove.js +5 -0
  26. package/dist/cjs/decorators/orm/BeforeUpdate.d.ts +1 -0
  27. package/dist/cjs/decorators/orm/BeforeUpdate.js +5 -0
  28. package/dist/cjs/decorators/orm/Check.d.ts +1 -0
  29. package/dist/cjs/decorators/orm/Check.js +5 -0
  30. package/dist/cjs/decorators/orm/ChildEntity.d.ts +1 -0
  31. package/dist/cjs/decorators/orm/ChildEntity.js +5 -0
  32. package/dist/cjs/decorators/orm/Column.d.ts +1 -0
  33. package/dist/cjs/decorators/orm/Column.js +5 -0
  34. package/dist/cjs/decorators/orm/CreateDateColumn.d.ts +1 -0
  35. package/dist/cjs/decorators/orm/CreateDateColumn.js +5 -0
  36. package/dist/cjs/decorators/orm/DeleteDateColumn.d.ts +1 -0
  37. package/dist/cjs/decorators/orm/DeleteDateColumn.js +5 -0
  38. package/dist/cjs/decorators/orm/Entity.d.ts +1 -0
  39. package/dist/cjs/decorators/orm/Entity.js +5 -0
  40. package/dist/cjs/decorators/orm/EventSubscriber.d.ts +1 -0
  41. package/dist/cjs/decorators/orm/EventSubscriber.js +5 -0
  42. package/dist/cjs/decorators/orm/Exclusion.d.ts +1 -0
  43. package/dist/cjs/decorators/orm/Exclusion.js +5 -0
  44. package/dist/cjs/decorators/orm/Generated.d.ts +1 -0
  45. package/dist/cjs/decorators/orm/Generated.js +5 -0
  46. package/dist/cjs/decorators/orm/Index.d.ts +1 -0
  47. package/dist/cjs/decorators/orm/Index.js +5 -0
  48. package/dist/cjs/decorators/orm/JoinColumn.d.ts +1 -0
  49. package/dist/cjs/decorators/orm/JoinColumn.js +5 -0
  50. package/dist/cjs/decorators/orm/JoinTable.d.ts +1 -0
  51. package/dist/cjs/decorators/orm/JoinTable.js +5 -0
  52. package/dist/cjs/decorators/orm/ManyToMany.d.ts +1 -0
  53. package/dist/cjs/decorators/orm/ManyToMany.js +5 -0
  54. package/dist/cjs/decorators/orm/ManyToOne.d.ts +1 -0
  55. package/dist/cjs/decorators/orm/ManyToOne.js +5 -0
  56. package/dist/cjs/decorators/orm/ObjectIdColumn.d.ts +1 -0
  57. package/dist/cjs/decorators/orm/ObjectIdColumn.js +5 -0
  58. package/dist/cjs/decorators/orm/OneToMany.d.ts +1 -0
  59. package/dist/cjs/decorators/orm/OneToMany.js +5 -0
  60. package/dist/cjs/decorators/orm/OneToOne.d.ts +1 -0
  61. package/dist/cjs/decorators/orm/OneToOne.js +5 -0
  62. package/dist/cjs/decorators/orm/PrimaryColumn.d.ts +1 -0
  63. package/dist/cjs/decorators/orm/PrimaryColumn.js +5 -0
  64. package/dist/cjs/decorators/orm/PrimaryGeneratedColumn.d.ts +1 -0
  65. package/dist/cjs/decorators/orm/PrimaryGeneratedColumn.js +5 -0
  66. package/dist/cjs/decorators/orm/RelationId.d.ts +1 -0
  67. package/dist/cjs/decorators/orm/RelationId.js +5 -0
  68. package/dist/cjs/decorators/orm/TableInheritance.d.ts +1 -0
  69. package/dist/cjs/decorators/orm/TableInheritance.js +5 -0
  70. package/dist/cjs/decorators/orm/Tree.d.ts +1 -0
  71. package/dist/cjs/decorators/orm/Tree.js +5 -0
  72. package/dist/cjs/decorators/orm/TreeChildren.d.ts +1 -0
  73. package/dist/cjs/decorators/orm/TreeChildren.js +5 -0
  74. package/dist/cjs/decorators/orm/TreeLevelColumn.d.ts +1 -0
  75. package/dist/cjs/decorators/orm/TreeLevelColumn.js +5 -0
  76. package/dist/cjs/decorators/orm/TreeParent.d.ts +1 -0
  77. package/dist/cjs/decorators/orm/TreeParent.js +5 -0
  78. package/dist/cjs/decorators/orm/Unique.d.ts +1 -0
  79. package/dist/cjs/decorators/orm/Unique.js +5 -0
  80. package/dist/cjs/decorators/orm/UpdateDateColumn.d.ts +1 -0
  81. package/dist/cjs/decorators/orm/UpdateDateColumn.js +5 -0
  82. package/dist/cjs/decorators/orm/VersionColumn.d.ts +1 -0
  83. package/dist/cjs/decorators/orm/VersionColumn.js +5 -0
  84. package/dist/cjs/decorators/orm/ViewColumn.d.ts +1 -0
  85. package/dist/cjs/decorators/orm/ViewColumn.js +5 -0
  86. package/dist/cjs/decorators/orm/ViewEntity.d.ts +1 -0
  87. package/dist/cjs/decorators/orm/ViewEntity.js +5 -0
  88. package/dist/cjs/decorators/orm/VirtualColumn.d.ts +1 -0
  89. package/dist/cjs/decorators/orm/VirtualColumn.js +5 -0
  90. package/dist/cjs/exports/DatabaseComponent.d.ts +3 -0
  91. package/dist/cjs/exports/DatabaseComponent.js +21 -0
  92. package/dist/cjs/exports/DatabaseProvider.d.ts +3 -0
  93. package/dist/cjs/exports/DatabaseProvider.js +21 -0
  94. package/dist/cjs/exports/ORM.d.ts +193 -0
  95. package/dist/cjs/exports/ORM.js +166 -0
  96. package/dist/cjs/exports/ORMDecorators.d.ts +43 -0
  97. package/dist/cjs/exports/ORMDecorators.js +91 -0
  98. package/dist/cjs/package.json +1 -0
  99. package/dist/cjs/providers/Database.d.ts +326 -0
  100. package/dist/cjs/providers/Database.js +376 -0
  101. package/dist/cjs/providers/migration/ExecuteMigration.d.ts +40 -0
  102. package/dist/cjs/providers/migration/ExecuteMigration.js +143 -0
  103. package/dist/cjs/providers/migration/GenerateMigration.d.ts +59 -0
  104. package/dist/cjs/providers/migration/GenerateMigration.js +303 -0
  105. package/dist/cjs/types/MigrationRunOptions.d.ts +19 -0
  106. package/dist/cjs/types/MigrationRunOptions.js +2 -0
  107. package/dist/esm/components/Database.js +344 -0
  108. package/dist/esm/decorators/orm/AfterInsert.js +1 -0
  109. package/dist/esm/decorators/orm/AfterLoad.js +1 -0
  110. package/dist/esm/decorators/orm/AfterRecover.js +1 -0
  111. package/dist/esm/decorators/orm/AfterRemove.js +1 -0
  112. package/dist/esm/decorators/orm/AfterSoftRemove.js +1 -0
  113. package/dist/esm/decorators/orm/AfterUpdate.js +1 -0
  114. package/dist/esm/decorators/orm/BeforeInsert.js +1 -0
  115. package/dist/esm/decorators/orm/BeforeRecover.js +1 -0
  116. package/dist/esm/decorators/orm/BeforeRemove.js +1 -0
  117. package/dist/esm/decorators/orm/BeforeSoftRemove.js +1 -0
  118. package/dist/esm/decorators/orm/BeforeUpdate.js +1 -0
  119. package/dist/esm/decorators/orm/Check.js +1 -0
  120. package/dist/esm/decorators/orm/ChildEntity.js +1 -0
  121. package/dist/esm/decorators/orm/Column.js +1 -0
  122. package/dist/esm/decorators/orm/CreateDateColumn.js +1 -0
  123. package/dist/esm/decorators/orm/DeleteDateColumn.js +1 -0
  124. package/dist/esm/decorators/orm/Entity.js +1 -0
  125. package/dist/esm/decorators/orm/EventSubscriber.js +1 -0
  126. package/dist/esm/decorators/orm/Exclusion.js +1 -0
  127. package/dist/esm/decorators/orm/Generated.js +1 -0
  128. package/dist/esm/decorators/orm/Index.js +1 -0
  129. package/dist/esm/decorators/orm/JoinColumn.js +1 -0
  130. package/dist/esm/decorators/orm/JoinTable.js +1 -0
  131. package/dist/esm/decorators/orm/ManyToMany.js +1 -0
  132. package/dist/esm/decorators/orm/ManyToOne.js +1 -0
  133. package/dist/esm/decorators/orm/ObjectIdColumn.js +1 -0
  134. package/dist/esm/decorators/orm/OneToMany.js +1 -0
  135. package/dist/esm/decorators/orm/OneToOne.js +1 -0
  136. package/dist/esm/decorators/orm/PrimaryColumn.js +1 -0
  137. package/dist/esm/decorators/orm/PrimaryGeneratedColumn.js +1 -0
  138. package/dist/esm/decorators/orm/RelationId.js +1 -0
  139. package/dist/esm/decorators/orm/TableInheritance.js +1 -0
  140. package/dist/esm/decorators/orm/Tree.js +1 -0
  141. package/dist/esm/decorators/orm/TreeChildren.js +1 -0
  142. package/dist/esm/decorators/orm/TreeLevelColumn.js +1 -0
  143. package/dist/esm/decorators/orm/TreeParent.js +1 -0
  144. package/dist/esm/decorators/orm/Unique.js +1 -0
  145. package/dist/esm/decorators/orm/UpdateDateColumn.js +1 -0
  146. package/dist/esm/decorators/orm/VersionColumn.js +1 -0
  147. package/dist/esm/decorators/orm/ViewColumn.js +1 -0
  148. package/dist/esm/decorators/orm/ViewEntity.js +1 -0
  149. package/dist/esm/decorators/orm/VirtualColumn.js +1 -0
  150. package/dist/esm/exports/DatabaseComponent.js +2 -0
  151. package/dist/esm/exports/DatabaseProvider.js +2 -0
  152. package/dist/esm/exports/ORM.js +120 -0
  153. package/dist/esm/exports/ORMDecorators.js +43 -0
  154. package/dist/esm/providers/Database.js +339 -0
  155. package/dist/esm/providers/migration/ExecuteMigration.js +137 -0
  156. package/dist/esm/providers/migration/GenerateMigration.js +297 -0
  157. package/dist/esm/types/MigrationRunOptions.js +1 -0
  158. package/dist/types/components/Database.d.ts +333 -0
  159. package/dist/types/decorators/orm/AfterInsert.d.ts +1 -0
  160. package/dist/types/decorators/orm/AfterLoad.d.ts +1 -0
  161. package/dist/types/decorators/orm/AfterRecover.d.ts +1 -0
  162. package/dist/types/decorators/orm/AfterRemove.d.ts +1 -0
  163. package/dist/types/decorators/orm/AfterSoftRemove.d.ts +1 -0
  164. package/dist/types/decorators/orm/AfterUpdate.d.ts +1 -0
  165. package/dist/types/decorators/orm/BeforeInsert.d.ts +1 -0
  166. package/dist/types/decorators/orm/BeforeRecover.d.ts +1 -0
  167. package/dist/types/decorators/orm/BeforeRemove.d.ts +1 -0
  168. package/dist/types/decorators/orm/BeforeSoftRemove.d.ts +1 -0
  169. package/dist/types/decorators/orm/BeforeUpdate.d.ts +1 -0
  170. package/dist/types/decorators/orm/Check.d.ts +1 -0
  171. package/dist/types/decorators/orm/ChildEntity.d.ts +1 -0
  172. package/dist/types/decorators/orm/Column.d.ts +1 -0
  173. package/dist/types/decorators/orm/CreateDateColumn.d.ts +1 -0
  174. package/dist/types/decorators/orm/DeleteDateColumn.d.ts +1 -0
  175. package/dist/types/decorators/orm/Entity.d.ts +1 -0
  176. package/dist/types/decorators/orm/EventSubscriber.d.ts +1 -0
  177. package/dist/types/decorators/orm/Exclusion.d.ts +1 -0
  178. package/dist/types/decorators/orm/Generated.d.ts +1 -0
  179. package/dist/types/decorators/orm/Index.d.ts +1 -0
  180. package/dist/types/decorators/orm/JoinColumn.d.ts +1 -0
  181. package/dist/types/decorators/orm/JoinTable.d.ts +1 -0
  182. package/dist/types/decorators/orm/ManyToMany.d.ts +1 -0
  183. package/dist/types/decorators/orm/ManyToOne.d.ts +1 -0
  184. package/dist/types/decorators/orm/ObjectIdColumn.d.ts +1 -0
  185. package/dist/types/decorators/orm/OneToMany.d.ts +1 -0
  186. package/dist/types/decorators/orm/OneToOne.d.ts +1 -0
  187. package/dist/types/decorators/orm/PrimaryColumn.d.ts +1 -0
  188. package/dist/types/decorators/orm/PrimaryGeneratedColumn.d.ts +1 -0
  189. package/dist/types/decorators/orm/RelationId.d.ts +1 -0
  190. package/dist/types/decorators/orm/TableInheritance.d.ts +1 -0
  191. package/dist/types/decorators/orm/Tree.d.ts +1 -0
  192. package/dist/types/decorators/orm/TreeChildren.d.ts +1 -0
  193. package/dist/types/decorators/orm/TreeLevelColumn.d.ts +1 -0
  194. package/dist/types/decorators/orm/TreeParent.d.ts +1 -0
  195. package/dist/types/decorators/orm/Unique.d.ts +1 -0
  196. package/dist/types/decorators/orm/UpdateDateColumn.d.ts +1 -0
  197. package/dist/types/decorators/orm/VersionColumn.d.ts +1 -0
  198. package/dist/types/decorators/orm/ViewColumn.d.ts +1 -0
  199. package/dist/types/decorators/orm/ViewEntity.d.ts +1 -0
  200. package/dist/types/decorators/orm/VirtualColumn.d.ts +1 -0
  201. package/dist/types/exports/DatabaseComponent.d.ts +3 -0
  202. package/dist/types/exports/DatabaseProvider.d.ts +3 -0
  203. package/dist/types/exports/ORM.d.ts +193 -0
  204. package/dist/types/exports/ORMDecorators.d.ts +43 -0
  205. package/dist/types/providers/Database.d.ts +326 -0
  206. package/dist/types/providers/migration/ExecuteMigration.d.ts +40 -0
  207. package/dist/types/providers/migration/GenerateMigration.d.ts +59 -0
  208. package/dist/types/types/MigrationRunOptions.d.ts +19 -0
  209. package/package.json +81 -4
@@ -0,0 +1,193 @@
1
+ import 'reflect-metadata';
2
+ export { type QueryResultCache } from 'typeorm/cache/QueryResultCache.js';
3
+ export { type QueryResultCacheOptions } from 'typeorm/cache/QueryResultCacheOptions.js';
4
+ export { type IsolationLevel } from 'typeorm/driver/types/IsolationLevel.js';
5
+ export * from 'typeorm/globals.js';
6
+ export * from 'typeorm/container.js';
7
+ export * from 'typeorm/common/EntityTarget.js';
8
+ export * from 'typeorm/common/ObjectType.js';
9
+ export * from 'typeorm/common/ObjectLiteral.js';
10
+ export * from 'typeorm/common/MixedList.js';
11
+ export * from 'typeorm/common/DeepPartial.js';
12
+ export * from 'typeorm/common/RelationType.js';
13
+ export * from 'typeorm/error/index.js';
14
+ export * from 'typeorm/decorator/options/ColumnOptions.js';
15
+ export * from 'typeorm/decorator/options/IndexOptions.js';
16
+ export * from 'typeorm/decorator/options/JoinColumnOptions.js';
17
+ export * from 'typeorm/decorator/options/JoinTableOptions.js';
18
+ export * from 'typeorm/decorator/options/RelationOptions.js';
19
+ export * from 'typeorm/decorator/options/EntityOptions.js';
20
+ export * from 'typeorm/decorator/options/ValueTransformer.js';
21
+ export * from 'typeorm/find-options/operator/And.js';
22
+ export * from 'typeorm/find-options/operator/Or.js';
23
+ export * from 'typeorm/find-options/operator/Any.js';
24
+ export * from 'typeorm/find-options/operator/ArrayContainedBy.js';
25
+ export * from 'typeorm/find-options/operator/ArrayContains.js';
26
+ export * from 'typeorm/find-options/operator/ArrayOverlap.js';
27
+ export * from 'typeorm/find-options/operator/Between.js';
28
+ export * from 'typeorm/find-options/operator/Equal.js';
29
+ export * from 'typeorm/find-options/operator/In.js';
30
+ export * from 'typeorm/find-options/operator/IsNull.js';
31
+ export * from 'typeorm/find-options/operator/LessThan.js';
32
+ export * from 'typeorm/find-options/operator/LessThanOrEqual.js';
33
+ export * from 'typeorm/find-options/operator/ILike.js';
34
+ export * from 'typeorm/find-options/operator/Like.js';
35
+ export * from 'typeorm/find-options/operator/MoreThan.js';
36
+ export * from 'typeorm/find-options/operator/MoreThanOrEqual.js';
37
+ export * from 'typeorm/find-options/operator/Not.js';
38
+ export * from 'typeorm/find-options/operator/Raw.js';
39
+ export * from 'typeorm/find-options/operator/JsonContains.js';
40
+ export * from 'typeorm/find-options/EqualOperator.js';
41
+ export * from 'typeorm/find-options/FindManyOptions.js';
42
+ export * from 'typeorm/find-options/FindOneOptions.js';
43
+ export * from 'typeorm/find-options/FindOperator.js';
44
+ export * from 'typeorm/find-options/FindOperatorType.js';
45
+ export * from 'typeorm/find-options/FindOptionsOrder.js';
46
+ export * from 'typeorm/find-options/FindOptionsRelations.js';
47
+ export * from 'typeorm/find-options/FindOptionsSelect.js';
48
+ export * from 'typeorm/find-options/FindOptionsUtils.js';
49
+ export * from 'typeorm/find-options/FindOptionsWhere.js';
50
+ export * from 'typeorm/find-options/FindTreeOptions.js';
51
+ export * from 'typeorm/find-options/JoinOptions.js';
52
+ export * from 'typeorm/find-options/OrderByCondition.js';
53
+ export * from 'typeorm/logger/AbstractLogger.js';
54
+ export * from 'typeorm/logger/Logger.js';
55
+ export * from 'typeorm/logger/LoggerOptions.js';
56
+ export * from 'typeorm/logger/AdvancedConsoleLogger.js';
57
+ export * from 'typeorm/logger/SimpleConsoleLogger.js';
58
+ export * from 'typeorm/logger/FileLogger.js';
59
+ export * from 'typeorm/metadata/EntityMetadata.js';
60
+ export * from 'typeorm/metadata/CheckMetadata.js';
61
+ export * from 'typeorm/metadata/ColumnMetadata.js';
62
+ export * from 'typeorm/metadata/EmbeddedMetadata.js';
63
+ export * from 'typeorm/metadata/EntityListenerMetadata.js';
64
+ export * from 'typeorm/metadata/ExclusionMetadata.js';
65
+ export * from 'typeorm/metadata/ForeignKeyMetadata.js';
66
+ export * from 'typeorm/metadata/IndexMetadata.js';
67
+ export * from 'typeorm/metadata/RelationMetadata.js';
68
+ export * from 'typeorm/metadata/RelationCountMetadata.js';
69
+ export * from 'typeorm/metadata/UniqueMetadata.js';
70
+ export * from 'typeorm/entity-manager/EntityManager.js';
71
+ export * from 'typeorm/repository/AbstractRepository.js';
72
+ export * from 'typeorm/repository/Repository.js';
73
+ export * from 'typeorm/repository/BaseEntity.js';
74
+ export * from 'typeorm/repository/TreeRepository.js';
75
+ export * from 'typeorm/repository/MongoRepository.js';
76
+ export * from 'typeorm/repository/RemoveOptions.js';
77
+ export * from 'typeorm/repository/SaveOptions.js';
78
+ export * from 'typeorm/schema-builder/table/TableCheck.js';
79
+ export * from 'typeorm/schema-builder/table/TableColumn.js';
80
+ export * from 'typeorm/schema-builder/table/TableExclusion.js';
81
+ export * from 'typeorm/schema-builder/table/TableForeignKey.js';
82
+ export * from 'typeorm/schema-builder/table/TableIndex.js';
83
+ export * from 'typeorm/schema-builder/table/TableUnique.js';
84
+ export * from 'typeorm/schema-builder/table/Table.js';
85
+ export * from 'typeorm/schema-builder/options/TableCheckOptions.js';
86
+ export * from 'typeorm/schema-builder/options/TableColumnOptions.js';
87
+ export * from 'typeorm/schema-builder/options/TableExclusionOptions.js';
88
+ export * from 'typeorm/schema-builder/options/TableForeignKeyOptions.js';
89
+ export * from 'typeorm/schema-builder/options/TableIndexOptions.js';
90
+ export * from 'typeorm/schema-builder/options/TableOptions.js';
91
+ export * from 'typeorm/schema-builder/options/TableUniqueOptions.js';
92
+ export * from 'typeorm/schema-builder/options/ViewOptions.js';
93
+ export * from 'typeorm/driver/mongodb/typings.js';
94
+ export * from 'typeorm/driver/types/DatabaseType.js';
95
+ export * from 'typeorm/driver/types/GeoJsonTypes.js';
96
+ export * from 'typeorm/driver/types/ReplicationMode.js';
97
+ export * from 'typeorm/driver/sqlserver/MssqlParameter.js';
98
+ export { ConnectionOptionsReader } from 'typeorm/connection/ConnectionOptionsReader.js';
99
+ export { type DataSourceOptions } from 'typeorm/data-source/DataSourceOptions.js';
100
+ export { type MysqlConnectionOptions } from 'typeorm/driver/mysql/MysqlConnectionOptions.js';
101
+ export { type MysqlConnectionCredentialsOptions } from 'typeorm/driver/mysql/MysqlConnectionCredentialsOptions.js';
102
+ export { type PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions.js';
103
+ export { type PostgresConnectionCredentialsOptions } from 'typeorm/driver/postgres/PostgresConnectionCredentialsOptions.js';
104
+ export { type CockroachConnectionOptions } from 'typeorm/driver/cockroachdb/CockroachConnectionOptions.js';
105
+ export { type CockroachConnectionCredentialsOptions } from 'typeorm/driver/cockroachdb/CockroachConnectionCredentialsOptions.js';
106
+ export { type SqliteConnectionOptions } from 'typeorm/driver/sqlite/SqliteConnectionOptions.js';
107
+ export { type SqlServerConnectionOptions } from 'typeorm/driver/sqlserver/SqlServerConnectionOptions.js';
108
+ export { type SqlServerConnectionCredentialsOptions } from 'typeorm/driver/sqlserver/SqlServerConnectionCredentialsOptions.js';
109
+ export { type SapConnectionOptions } from 'typeorm/driver/sap/SapConnectionOptions.js';
110
+ export { type SapConnectionCredentialsOptions } from 'typeorm/driver/sap/SapConnectionCredentialsOptions.js';
111
+ export { type OracleConnectionOptions } from 'typeorm/driver/oracle/OracleConnectionOptions.js';
112
+ export { type OracleConnectionCredentialsOptions } from 'typeorm/driver/oracle/OracleConnectionCredentialsOptions.js';
113
+ export { type CordovaConnectionOptions } from 'typeorm/driver/cordova/CordovaConnectionOptions.js';
114
+ export { type NativescriptConnectionOptions } from 'typeorm/driver/nativescript/NativescriptConnectionOptions.js';
115
+ export { type ReactNativeConnectionOptions } from 'typeorm/driver/react-native/ReactNativeConnectionOptions.js';
116
+ export { type SqljsConnectionOptions } from 'typeorm/driver/sqljs/SqljsConnectionOptions.js';
117
+ export { type MongoConnectionOptions } from 'typeorm/driver/mongodb/MongoConnectionOptions.js';
118
+ export { type AuroraMysqlConnectionOptions } from 'typeorm/driver/aurora-mysql/AuroraMysqlConnectionOptions.js';
119
+ export { type AuroraMysqlConnectionCredentialsOptions } from 'typeorm/driver/aurora-mysql/AuroraMysqlConnectionCredentialsOptions.js';
120
+ export { type AuroraPostgresConnectionOptions } from 'typeorm/driver/aurora-postgres/AuroraPostgresConnectionOptions.js';
121
+ export { type ExpoConnectionOptions } from 'typeorm/driver/expo/ExpoConnectionOptions.js';
122
+ export { type BetterSqlite3ConnectionOptions } from 'typeorm/driver/better-sqlite3/BetterSqlite3ConnectionOptions.js';
123
+ export { type CapacitorConnectionOptions } from 'typeorm/driver/capacitor/CapacitorConnectionOptions.js';
124
+ export { type SpannerConnectionOptions } from 'typeorm/driver/spanner/SpannerConnectionOptions.js';
125
+ export { type SpannerConnectionCredentialsOptions } from 'typeorm/driver/spanner/SpannerConnectionCredentialsOptions.js';
126
+ export { DataSource } from 'typeorm/data-source/DataSource.js';
127
+ export { type QueryRunner } from 'typeorm/query-runner/QueryRunner.js';
128
+ export { type Driver } from 'typeorm/driver/Driver.js';
129
+ export { type NamingStrategyInterface } from 'typeorm/naming-strategy/NamingStrategyInterface.js';
130
+ export { type EntitySubscriberInterface } from 'typeorm/subscriber/EntitySubscriberInterface.js';
131
+ export { QueryBuilder } from 'typeorm/query-builder/QueryBuilder.js';
132
+ export { SelectQueryBuilder } from 'typeorm/query-builder/SelectQueryBuilder.js';
133
+ export { DeleteQueryBuilder } from 'typeorm/query-builder/DeleteQueryBuilder.js';
134
+ export { InsertQueryBuilder } from 'typeorm/query-builder/InsertQueryBuilder.js';
135
+ export { UpdateQueryBuilder } from 'typeorm/query-builder/UpdateQueryBuilder.js';
136
+ export { RelationQueryBuilder } from 'typeorm/query-builder/RelationQueryBuilder.js';
137
+ export { Brackets } from 'typeorm/query-builder/Brackets.js';
138
+ export { NotBrackets } from 'typeorm/query-builder/NotBrackets.js';
139
+ export { InsertResult } from 'typeorm/query-builder/result/InsertResult.js';
140
+ export { UpdateResult } from 'typeorm/query-builder/result/UpdateResult.js';
141
+ export { DeleteResult } from 'typeorm/query-builder/result/DeleteResult.js';
142
+ export { QueryResult } from 'typeorm/query-runner/QueryResult.js';
143
+ export { MongoEntityManager } from 'typeorm/entity-manager/MongoEntityManager.js';
144
+ export { Migration } from 'typeorm/migration/Migration.js';
145
+ export { MigrationExecutor } from 'typeorm/migration/MigrationExecutor.js';
146
+ export { DefaultNamingStrategy } from 'typeorm/naming-strategy/DefaultNamingStrategy.js';
147
+ export { LegacyOracleNamingStrategy } from 'typeorm/naming-strategy/LegacyOracleNamingStrategy.js';
148
+ export { EntitySchema } from 'typeorm/entity-schema/EntitySchema.js';
149
+ export { EntitySchemaEmbeddedColumnOptions } from 'typeorm/entity-schema/EntitySchemaEmbeddedColumnOptions.js';
150
+ export { EntitySchemaOptions } from 'typeorm/entity-schema/EntitySchemaOptions.js';
151
+ export { InstanceChecker } from 'typeorm/util/InstanceChecker.js';
152
+ export { TreeRepositoryUtils } from 'typeorm/util/TreeRepositoryUtils.js';
153
+ export { type WhereExpressionBuilder } from 'typeorm/query-builder/WhereExpressionBuilder.js';
154
+ export { type MigrationInterface } from 'typeorm/migration/MigrationInterface.js';
155
+ export { type InsertEvent } from 'typeorm/subscriber/event/InsertEvent.js';
156
+ export { type LoadEvent } from 'typeorm/subscriber/event/LoadEvent.js';
157
+ export { type UpdateEvent } from 'typeorm/subscriber/event/UpdateEvent.js';
158
+ export { type RemoveEvent } from 'typeorm/subscriber/event/RemoveEvent.js';
159
+ export { type SoftRemoveEvent } from 'typeorm/subscriber/event/SoftRemoveEvent.js';
160
+ export { type RecoverEvent } from 'typeorm/subscriber/event/RecoverEvent.js';
161
+ export { type TransactionCommitEvent } from 'typeorm/subscriber/event/TransactionCommitEvent.js';
162
+ export { type TransactionRollbackEvent } from 'typeorm/subscriber/event/TransactionRollbackEvent.js';
163
+ export { type TransactionStartEvent } from 'typeorm/subscriber/event/TransactionStartEvent.js';
164
+ export { type EntitySchemaColumnOptions } from 'typeorm/entity-schema/EntitySchemaColumnOptions.js';
165
+ export { type EntitySchemaIndexOptions } from 'typeorm/entity-schema/EntitySchemaIndexOptions.js';
166
+ export { type EntitySchemaRelationOptions } from 'typeorm/entity-schema/EntitySchemaRelationOptions.js';
167
+ export { type ColumnType } from 'typeorm/driver/types/ColumnTypes.js';
168
+ export { getMetadataArgsStorage } from 'typeorm/globals.js';
169
+ export { MetadataArgsStorage } from 'typeorm/metadata-args/MetadataArgsStorage.js';
170
+ export { type CheckMetadataArgs } from 'typeorm/metadata-args/CheckMetadataArgs.js';
171
+ export { type ColumnMetadataArgs } from 'typeorm/metadata-args/ColumnMetadataArgs.js';
172
+ export { type DiscriminatorValueMetadataArgs } from 'typeorm/metadata-args/DiscriminatorValueMetadataArgs.js';
173
+ export { type EmbeddedMetadataArgs } from 'typeorm/metadata-args/EmbeddedMetadataArgs.js';
174
+ export { type EntityListenerMetadataArgs } from 'typeorm/metadata-args/EntityListenerMetadataArgs.js';
175
+ export { type EntityRepositoryMetadataArgs } from 'typeorm/metadata-args/EntityRepositoryMetadataArgs.js';
176
+ export { type EntitySubscriberMetadataArgs } from 'typeorm/metadata-args/EntitySubscriberMetadataArgs.js';
177
+ export { type ExclusionMetadataArgs } from 'typeorm/metadata-args/ExclusionMetadataArgs.js';
178
+ export { type ForeignKeyMetadataArgs } from 'typeorm/metadata-args/ForeignKeyMetadataArgs.js';
179
+ export { type GeneratedMetadataArgs } from 'typeorm/metadata-args/GeneratedMetadataArgs.js';
180
+ export { type IndexMetadataArgs } from 'typeorm/metadata-args/IndexMetadataArgs.js';
181
+ export { type InheritanceMetadataArgs } from 'typeorm/metadata-args/InheritanceMetadataArgs.js';
182
+ export { type JoinColumnMetadataArgs } from 'typeorm/metadata-args/JoinColumnMetadataArgs.js';
183
+ export { type JoinTableMetadataArgs } from 'typeorm/metadata-args/JoinTableMetadataArgs.js';
184
+ export { type NamingStrategyMetadataArgs } from 'typeorm/metadata-args/NamingStrategyMetadataArgs.js';
185
+ export { type RelationCountMetadataArgs } from 'typeorm/metadata-args/RelationCountMetadataArgs.js';
186
+ export { type RelationIdMetadataArgs } from 'typeorm/metadata-args/RelationIdMetadataArgs.js';
187
+ export { type RelationMetadataArgs } from 'typeorm/metadata-args/RelationMetadataArgs.js';
188
+ export { type TableMetadataArgs } from 'typeorm/metadata-args/TableMetadataArgs.js';
189
+ export { type TransactionEntityMetadataArgs } from 'typeorm/metadata-args/TransactionEntityMetadataArgs.js';
190
+ export { type TransactionRepositoryMetadataArgs } from 'typeorm/metadata-args/TransactionRepositoryMetadataArgs.js';
191
+ export { type TreeMetadataArgs } from 'typeorm/metadata-args/TreeMetadataArgs.js';
192
+ export { type UniqueMetadataArgs } from 'typeorm/metadata-args/UniqueMetadataArgs.js';
193
+ export { type ColumnMode } from 'typeorm/metadata-args/types/ColumnMode.js';
@@ -0,0 +1,43 @@
1
+ import 'reflect-metadata';
2
+ export { AfterRecover } from '../decorators/orm/AfterRecover.js';
3
+ export { AfterRemove } from '../decorators/orm/AfterRemove.js';
4
+ export { AfterInsert } from '../decorators/orm/AfterInsert.js';
5
+ export { AfterLoad } from '../decorators/orm/AfterLoad.js';
6
+ export { AfterSoftRemove } from '../decorators/orm/AfterSoftRemove.js';
7
+ export { AfterUpdate } from '../decorators/orm/AfterUpdate.js';
8
+ export { BeforeInsert } from '../decorators/orm/BeforeInsert.js';
9
+ export { BeforeRecover } from '../decorators/orm/BeforeRecover.js';
10
+ export { BeforeRemove } from '../decorators/orm/BeforeRemove.js';
11
+ export { BeforeSoftRemove } from '../decorators/orm/BeforeSoftRemove.js';
12
+ export { BeforeUpdate } from '../decorators/orm/BeforeUpdate.js';
13
+ export { Check } from '../decorators/orm/Check.js';
14
+ export { ChildEntity } from '../decorators/orm/ChildEntity.js';
15
+ export { Column } from '../decorators/orm/Column.js';
16
+ export { CreateDateColumn } from '../decorators/orm/CreateDateColumn.js';
17
+ export { DeleteDateColumn } from '../decorators/orm/DeleteDateColumn.js';
18
+ export { Entity } from '../decorators/orm/Entity.js';
19
+ export { EventSubscriber } from '../decorators/orm/EventSubscriber.js';
20
+ export { Exclusion } from '../decorators/orm/Exclusion.js';
21
+ export { Generated } from '../decorators/orm/Generated.js';
22
+ export { Index } from '../decorators/orm/Index.js';
23
+ export { JoinColumn } from '../decorators/orm/JoinColumn.js';
24
+ export { JoinTable } from '../decorators/orm/JoinTable.js';
25
+ export { ManyToMany } from '../decorators/orm/ManyToMany.js';
26
+ export { ManyToOne } from '../decorators/orm/ManyToOne.js';
27
+ export { ObjectIdColumn } from '../decorators/orm/ObjectIdColumn.js';
28
+ export { OneToMany } from '../decorators/orm/OneToMany.js';
29
+ export { OneToOne } from '../decorators/orm/OneToOne.js';
30
+ export { PrimaryColumn } from '../decorators/orm/PrimaryColumn.js';
31
+ export { PrimaryGeneratedColumn } from '../decorators/orm/PrimaryGeneratedColumn.js';
32
+ export { RelationId } from '../decorators/orm/RelationId.js';
33
+ export { TableInheritance } from '../decorators/orm/TableInheritance.js';
34
+ export { Tree } from '../decorators/orm/Tree.js';
35
+ export { TreeChildren } from '../decorators/orm/TreeChildren.js';
36
+ export { TreeLevelColumn } from '../decorators/orm/TreeLevelColumn.js';
37
+ export { TreeParent } from '../decorators/orm/TreeParent.js';
38
+ export { Unique } from '../decorators/orm/Unique.js';
39
+ export { UpdateDateColumn } from '../decorators/orm/UpdateDateColumn.js';
40
+ export { VersionColumn } from '../decorators/orm/VersionColumn.js';
41
+ export { ViewColumn } from '../decorators/orm/ViewColumn.js';
42
+ export { ViewEntity } from '../decorators/orm/ViewEntity.js';
43
+ export { VirtualColumn } from '../decorators/orm/VirtualColumn.js';
@@ -0,0 +1,326 @@
1
+ import { type DataSourceOptions } from 'typeorm/data-source/DataSourceOptions.js';
2
+ import { DataSource } from 'typeorm/data-source/DataSource.js';
3
+ import { Driver } from 'typeorm/driver/Driver.js';
4
+ import { EntityManager } from 'typeorm/entity-manager/EntityManager.js';
5
+ import { NamingStrategyInterface } from 'typeorm/naming-strategy/NamingStrategyInterface.js';
6
+ import { EntitySubscriberInterface } from 'typeorm/subscriber/EntitySubscriberInterface.js';
7
+ import { EntityMetadata } from 'typeorm/metadata/EntityMetadata.js';
8
+ import { EntityTarget } from 'typeorm/common/EntityTarget.js';
9
+ import { Migration } from 'typeorm/migration/Migration.js';
10
+ import { ObjectLiteral } from 'typeorm/common/ObjectLiteral.js';
11
+ import { TreeRepository } from 'typeorm/repository/TreeRepository.js';
12
+ import { Repository } from 'typeorm/repository/Repository.js';
13
+ import { MongoRepository } from 'typeorm/repository/MongoRepository.js';
14
+ import { QueryRunner } from 'typeorm/query-runner/QueryRunner.js';
15
+ import { SelectQueryBuilder } from 'typeorm/query-builder/SelectQueryBuilder.js';
16
+ import { ReplicationMode } from 'typeorm/driver/types/ReplicationMode.js';
17
+ import { QueryResultCache } from 'typeorm/cache/QueryResultCache.js';
18
+ import { IsolationLevel } from 'typeorm/driver/types/IsolationLevel.js';
19
+ import { Provider } from '@lakutata/core';
20
+ import { EntitySchema, type MixedList } from 'typeorm';
21
+ import { type MigrationRunOptions } from '../types/MigrationRunOptions.js';
22
+ /**
23
+ * Build the registration of a {@link Database} provider, for the `providers` of the application options: the provider
24
+ * class with its TypeORM connection options. Its `entities` option, added to the entities of the connection options,
25
+ * is set by spreading the registration: `{...buildDatabaseOptions(options), entities: [User]}`.
26
+ * @param options The TypeORM connection options (`DataSourceOptions`): the driver `type`, the connection settings, the
27
+ * `entities`, the `migrations`, `synchronize`, `migrationsRun`, `logging`… Passed to TypeORM as they are.
28
+ * @returns The registration `{class: Database, options}`.
29
+ * @example
30
+ * ```typescript
31
+ * import {Application} from 'lakutata'
32
+ * import {buildDatabaseOptions} from 'lakutata/provider/database'
33
+ * import {Column, Entity, PrimaryGeneratedColumn} from 'lakutata/decorator/orm'
34
+ *
35
+ * @Entity()
36
+ * class Report {
37
+ * @PrimaryGeneratedColumn()
38
+ * public id: number
39
+ *
40
+ * @Column('text')
41
+ * public content: string
42
+ * }
43
+ *
44
+ * Application.run(() => ({
45
+ * id: 'com.example.reports',
46
+ * name: 'Reports',
47
+ * providers: {
48
+ * //A new PostgreSQL connection each time reports is resolved, closed with its owner
49
+ * reports: {
50
+ * ...buildDatabaseOptions({type: 'postgres', url: 'postgres://postgres:secret@localhost:5432/reports'}),
51
+ * entities: [Report]
52
+ * }
53
+ * }
54
+ * }))
55
+ * ```
56
+ */
57
+ export declare const buildDatabaseOptions: (options: DataSourceOptions) => {
58
+ class: typeof Database;
59
+ options: DataSourceOptions;
60
+ };
61
+ /**
62
+ * A database connection of its own: a transient provider wrapping a TypeORM `DataSource`, with the API of the
63
+ * `Database` component of `lakutata/com/database`.
64
+ *
65
+ * Register it in the `providers` of the application options with {@link buildDatabaseOptions}. Each resolution
66
+ * (`@Inject('reports')`, `getObject('reports')`) creates a new instance, even within one scope: it opens its own
67
+ * connection (its own pool) while it is created, and closes it when it is destroyed with the object or the container
68
+ * which created it. It suits a short use (a job, a script, a tenant database); the requests of a busy application
69
+ * share the `Database` component instead. A connection failure rejects its creation with the driver error.
70
+ *
71
+ * The entities of its `entities` option are added to the entities of its connection options.
72
+ * @example
73
+ * ```typescript
74
+ * import {Application} from 'lakutata'
75
+ * import {buildDatabaseOptions, Database} from 'lakutata/provider/database'
76
+ * import {Column, Entity, PrimaryGeneratedColumn} from 'lakutata/decorator/orm'
77
+ *
78
+ * @Entity()
79
+ * class Report {
80
+ * @PrimaryGeneratedColumn()
81
+ * public id: number
82
+ *
83
+ * @Column('text')
84
+ * public content: string
85
+ * }
86
+ *
87
+ * Application
88
+ * .run(() => ({
89
+ * id: 'com.example.reports',
90
+ * name: 'Reports',
91
+ * providers: {
92
+ * reports: {
93
+ * ...buildDatabaseOptions({type: 'postgres', url: 'postgres://postgres:secret@localhost:5432/reports', synchronize: true}),
94
+ * entities: [Report]
95
+ * }
96
+ * }
97
+ * }))
98
+ * .onLaunched(async (app: Application): Promise<void> => {
99
+ * //A connection opened for this use, closed with the application
100
+ * const database: Database = await app.getObject('reports')
101
+ * await database.transaction(async (manager): Promise<void> => {
102
+ * await manager.save(Report, {content: 'Daily report'})
103
+ * })
104
+ * console.log(await database.getRepository(Report).count())
105
+ * })
106
+ * ```
107
+ */
108
+ export declare class Database extends Provider {
109
+ #private;
110
+ /**
111
+ * Load the provider generating the migrations of the database. The application calls it when it is started with
112
+ * `MIGRATION_GENERATE`: the applications do not call it.
113
+ * @returns The migration generator provider class.
114
+ */
115
+ static migrationGenerator: () => Promise<typeof Provider>;
116
+ /**
117
+ * Load the provider running, reverting or showing the migrations of the database. The application calls it when it
118
+ * is started with `MIGRATION_RUN`, `MIGRATION_REVERT` or `MIGRATION_SHOW`: the applications do not call it.
119
+ * @returns The migration executor provider class.
120
+ */
121
+ static migrationExecutor: () => Promise<typeof Provider>;
122
+ /**
123
+ * The TypeORM connection options, given by the registration (see {@link buildDatabaseOptions}). Not validated by
124
+ * lakutata: TypeORM checks them while connecting.
125
+ */
126
+ protected readonly options: DataSourceOptions;
127
+ /**
128
+ * The entities added to the `entities` of the connection options: classes, `EntitySchema`s or glob paths of their
129
+ * files. The migration commands of the application (`MIGRATION_GENERATE`…) read the connection options only, not
130
+ * this option.
131
+ * @default []
132
+ */
133
+ protected readonly entities: MixedList<Function | string | EntitySchema>;
134
+ /**
135
+ * The TypeORM `DataSource` of the connection, for the subclasses needing what this class does not expose.
136
+ */
137
+ protected get datasource(): DataSource;
138
+ /**
139
+ * The TypeORM driver of the connection (PostgreSQL, MySQL, SQLite…).
140
+ */
141
+ get driver(): Driver;
142
+ /**
143
+ * The entity manager of the connection: the TypeORM operations on any entity (`find`, `save`, `delete`…) outside a
144
+ * transaction.
145
+ */
146
+ get manager(): EntityManager;
147
+ /**
148
+ * Replace the naming strategy of the connection, which names the tables, the columns and the constraints of the
149
+ * entities. Set it before the metadata is used: the names already built are not renamed.
150
+ * @param instance The naming strategy.
151
+ */
152
+ set namingStrategy(instance: NamingStrategyInterface);
153
+ /**
154
+ * The naming strategy of the connection, which names the tables, the columns and the constraints of the entities.
155
+ * @default TypeORM's `DefaultNamingStrategy`, unless the options set `namingStrategy`
156
+ */
157
+ get namingStrategy(): NamingStrategyInterface;
158
+ /**
159
+ * The entity subscribers registered on the connection (the `subscribers` of the options).
160
+ */
161
+ get subscribers(): EntitySubscriberInterface<any>[];
162
+ /**
163
+ * The metadata of every entity registered on the connection.
164
+ */
165
+ get entityMetadatas(): EntityMetadata[];
166
+ /**
167
+ * The metadata of every entity registered on the connection, by entity target (class, name or schema): the same as
168
+ * {@link Database.entityMetadatas}, for fast lookups.
169
+ */
170
+ get entityMetadatasMap(): Map<EntityTarget<any>, EntityMetadata>;
171
+ /**
172
+ * The query result cache of the connection, `undefined` unless the options enable `cache`.
173
+ */
174
+ get queryResultCache(): QueryResultCache | undefined;
175
+ /**
176
+ * Connect to the database with the options, their entities and the ones of the `entities` option.
177
+ * @protected
178
+ */
179
+ protected init(): Promise<void>;
180
+ /**
181
+ * Disconnect from the database.
182
+ * @protected
183
+ */
184
+ protected destroy(): Promise<void>;
185
+ /**
186
+ * Create or update the database schema from the registered entities (the tables, columns, indices and foreign
187
+ * keys). Meant for development: the migrations change the schema of a production database.
188
+ * @param dropBeforeSync Drop every table of the database schema, with its data (also the tables of no entity),
189
+ * before creating the schema. Defaults to `false`.
190
+ * @returns Resolves once the schema is built.
191
+ * @throws {CannotExecuteNotConnectedError} When the connection is closed.
192
+ */
193
+ synchronize(dropBeforeSync?: boolean): Promise<void>;
194
+ /**
195
+ * Run the pending migrations (the `migrations` of the options not yet recorded in the migrations table), in their
196
+ * timestamp order.
197
+ * @param options The transactions of the migrations, and whether they are only recorded (`fake`).
198
+ * @returns The migrations run, an empty array when none is pending.
199
+ * @throws {CannotExecuteNotConnectedError} When the connection is closed.
200
+ * @throws {Error} The error of a failed migration, once its transaction (`'all'` or `'each'`) is rolled back.
201
+ */
202
+ runMigrations(options?: MigrationRunOptions): Promise<Migration[]>;
203
+ /**
204
+ * Revert the last migration run (its `down()`), and remove it from the migrations table. Does nothing when no
205
+ * migration was run.
206
+ * @param options The transaction of the migration (`'all'` by default, `migrationsTransactionMode` not applying),
207
+ * and whether it is only removed from the migrations table (`fake`).
208
+ * @returns Resolves once the migration is reverted.
209
+ * @throws {CannotExecuteNotConnectedError} When the connection is closed.
210
+ */
211
+ undoLastMigration(options?: MigrationRunOptions): Promise<void>;
212
+ /**
213
+ * Log each migration of the options with whether it was run (`[X]`) or not (`[ ]`), through the logger of the
214
+ * connection (shown when its `logging` includes `schema`).
215
+ * @returns Whether a migration is pending.
216
+ */
217
+ showMigrations(): Promise<boolean>;
218
+ /**
219
+ * Whether an entity is registered on the connection.
220
+ * @param target The entity class, its name, or its table name.
221
+ * @returns `true` when the connection has its metadata.
222
+ */
223
+ hasMetadata(target: EntityTarget<any>): boolean;
224
+ /**
225
+ * The metadata of a registered entity: its table, columns, relations…
226
+ * @param target The entity class, its name, or its table name.
227
+ * @returns The metadata of the entity.
228
+ * @throws {EntityMetadataNotFoundError} When the entity is not registered on the connection.
229
+ */
230
+ getMetadata(target: EntityTarget<any>): EntityMetadata;
231
+ /**
232
+ * The repository of an entity, created once per entity: its `find`, `save`, `delete`… operations outside a
233
+ * transaction (in a transaction, use the entity manager given to the callback).
234
+ * @param target The entity class, its name, or its `EntitySchema`.
235
+ * @returns The repository of the entity (a `MongoRepository` on a MongoDB connection).
236
+ * @throws {EntityMetadataNotFoundError} From the repository operations, when the entity is not registered.
237
+ */
238
+ getRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): Repository<Entity>;
239
+ /**
240
+ * The tree repository of an entity decorated with `@Tree()`: the operations on its ancestors and descendants
241
+ * (`findTrees`, `findDescendants`…).
242
+ * @param target The tree entity class, or its name.
243
+ * @returns The tree repository of the entity.
244
+ * @throws {TreeRepositoryNotSupportedError} On a driver without tree support (MongoDB).
245
+ */
246
+ getTreeRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): TreeRepository<Entity>;
247
+ /**
248
+ * The MongoDB repository of an entity: the repository operations plus the MongoDB ones (`aggregate`, `bulkWrite`…).
249
+ * @param target The entity class, or its name.
250
+ * @returns The MongoDB repository of the entity.
251
+ * @throws {TypeORMError} When the connection is not a MongoDB one.
252
+ */
253
+ getMongoRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): MongoRepository<Entity>;
254
+ /**
255
+ * Run a function in a transaction, on one connection of the pool: committed when the function resolves, rolled
256
+ * back when it rejects (its error rethrown). Every operation of the transaction goes through the entity manager given
257
+ * to the function: the ones made through {@link Database.manager} or the repositories of this object run outside of
258
+ * it.
259
+ * @param runInTransaction The function, given the entity manager of the transaction.
260
+ * @returns What the function resolves.
261
+ * @throws {Error} The error of the function, or of the database, after the rollback.
262
+ */
263
+ transaction<T>(runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;
264
+ /**
265
+ * Run a function in a transaction with an isolation level, on one connection of the pool: committed when the
266
+ * function resolves, rolled back when it rejects (its error rethrown). Every operation of the transaction goes
267
+ * through the entity manager given to the function.
268
+ * @param isolationLevel The isolation level: `'READ UNCOMMITTED'`, `'READ COMMITTED'`, `'REPEATABLE READ'` or
269
+ * `'SERIALIZABLE'` (the levels the driver supports).
270
+ * @param runInTransaction The function, given the entity manager of the transaction.
271
+ * @returns What the function resolves.
272
+ * @throws {Error} The error of the function, or of the database, after the rollback.
273
+ */
274
+ transaction<T>(isolationLevel: IsolationLevel, runInTransaction: (entityManager: EntityManager) => Promise<T>): Promise<T>;
275
+ /**
276
+ * Run a raw SQL query.
277
+ * @param query The SQL, its parameters as placeholders: `$1`, `$2`… for PostgreSQL, `?` for MySQL and SQLite.
278
+ * @param parameters The values of the placeholders, escaped by the driver.
279
+ * @param queryRunner The query runner to run it on (a transaction of {@link Database.createQueryRunner}), a
280
+ * connection of the pool otherwise.
281
+ * @returns The raw result of the driver: the rows of a `SELECT` (an array of objects).
282
+ * @throws {QueryFailedError} When the database rejects the query.
283
+ */
284
+ query<T = any>(query: string, parameters?: any[], queryRunner?: QueryRunner): Promise<T>;
285
+ /**
286
+ * Create a query builder selecting an entity.
287
+ * @param entityClass The entity class, its name, or its `EntitySchema`.
288
+ * @param alias The alias of the entity in the query (`'user'` in `user.name`).
289
+ * @param queryRunner The query runner to run the query on, a connection of the pool otherwise.
290
+ * @returns The query builder, selecting the entity from its table.
291
+ * @throws {EntityMetadataNotFoundError} When the entity is not registered.
292
+ * @throws {TypeORMError} On a MongoDB connection, which has no query builder.
293
+ */
294
+ createQueryBuilder<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
295
+ /**
296
+ * Create an empty query builder, its selection and source set by its `select()` and `from()`.
297
+ * @param queryRunner The query runner to run the query on, a connection of the pool otherwise.
298
+ * @returns The query builder.
299
+ * @throws {TypeORMError} On a MongoDB connection, which has no query builder.
300
+ */
301
+ createQueryBuilder(queryRunner?: QueryRunner): SelectQueryBuilder<any>;
302
+ /**
303
+ * Create a query runner: one connection taken from the pool, to run several queries on the same connection and
304
+ * control its transaction by hand (`connect()`, `startTransaction()`, `commitTransaction()`,
305
+ * `rollbackTransaction()`). The caller must `release()` it, or the connection stays taken.
306
+ * @param mode With replication, `'master'` (the default) for the writes, `'slave'` for the reads on a replica.
307
+ * @returns The query runner, not connected until its first query or `connect()`.
308
+ */
309
+ createQueryRunner(mode?: ReplicationMode): QueryRunner;
310
+ /**
311
+ * The metadata of the junction table of a many-to-many relation.
312
+ * @param entityTarget The entity owning the relation.
313
+ * @param relationPropertyPath The property of the relation (`'tags'`, or a path such as `'profile.tags'`).
314
+ * @returns The metadata of the junction table.
315
+ * @throws {EntityMetadataNotFoundError} When the entity is not registered.
316
+ * @throws {TypeORMError} When the entity has no such relation, or the relation is not a many-to-many one.
317
+ */
318
+ getManyToManyMetadata(entityTarget: EntityTarget<any>, relationPropertyPath: string): EntityMetadata | undefined;
319
+ /**
320
+ * Create an entity manager on the connection, bound to a query runner when given (its operations then run on the
321
+ * runner's connection and transaction).
322
+ * @param queryRunner The query runner the manager uses, a connection of the pool per operation otherwise.
323
+ * @returns The entity manager.
324
+ */
325
+ createEntityManager(queryRunner?: QueryRunner): EntityManager;
326
+ }
@@ -0,0 +1,40 @@
1
+ import { Provider } from '@lakutata/core';
2
+ import { type DataSourceOptions } from 'typeorm/data-source/DataSourceOptions.js';
3
+ import { DataSource } from 'typeorm/data-source/DataSource.js';
4
+ /**
5
+ * The actions on the migrations of a database
6
+ */
7
+ export type MigrationAction = 'run' | 'revert' | 'show';
8
+ /**
9
+ * Run, revert or show the migrations of a database of the application, with its options (MIGRATION_RUN, MIGRATION_REVERT,
10
+ * MIGRATION_SHOW): the database is connected without synchronizing its schema nor running its migrations, the action
11
+ * done, then the application exits (with the code 1 when the action fails)
12
+ */
13
+ export declare class ExecuteMigration extends Provider {
14
+ protected readonly action: MigrationAction;
15
+ protected readonly dataSourceName: string;
16
+ protected readonly dataSource: DataSourceOptions;
17
+ protected readonly transaction?: 'all' | 'none' | 'each';
18
+ /**
19
+ * The transactions of the migrations: MIGRATION_TRANSACTION, else the migrationsTransactionMode of the database, else
20
+ * one for all
21
+ */
22
+ protected get transactionMode(): 'all' | 'none' | 'each';
23
+ protected readonly fake: boolean;
24
+ protected readonly exitProcess: boolean;
25
+ /**
26
+ * The prefix of the messages: the name of the database
27
+ */
28
+ protected get prefix(): string;
29
+ /**
30
+ * Initializer
31
+ * @protected
32
+ */
33
+ protected init(): Promise<void>;
34
+ /**
35
+ * Do the action on the database
36
+ * @param dataSource
37
+ * @protected
38
+ */
39
+ protected handle(dataSource: DataSource): Promise<void>;
40
+ }