test-entity-library-asm 3.9.39 → 3.9.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -3
- package/package.json +1 -1
- package/src/index.ts +15 -3
package/dist/index.js
CHANGED
|
@@ -113,13 +113,23 @@ function getTimezoneOffset(timezone) {
|
|
|
113
113
|
return offset;
|
|
114
114
|
}
|
|
115
115
|
exports.getTimezoneOffset = getTimezoneOffset;
|
|
116
|
+
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
117
|
+
// entity: EntityTarget<T>,
|
|
118
|
+
// ): Promise<CustomRepository<T>> => {
|
|
119
|
+
// if (!connection) {
|
|
120
|
+
// connection = createDataBaseSource();
|
|
121
|
+
// await connection.initialize();
|
|
122
|
+
// }
|
|
123
|
+
// return connection
|
|
124
|
+
// .getRepository(entity)
|
|
125
|
+
// .extend(CustomRepository.prototype) as CustomRepository<T>;
|
|
126
|
+
// };
|
|
116
127
|
const getRepositoryByEntity = async (entity) => {
|
|
117
128
|
if (!connection) {
|
|
118
129
|
connection = createDataBaseSource();
|
|
119
130
|
await connection.initialize();
|
|
131
|
+
console.log(connection.entityMetadatas.map((e) => e.name));
|
|
120
132
|
}
|
|
121
|
-
return connection
|
|
122
|
-
.getRepository(entity)
|
|
123
|
-
.extend(_1.CustomRepository.prototype);
|
|
133
|
+
return new _1.CustomRepository(entity, connection);
|
|
124
134
|
};
|
|
125
135
|
exports.getRepositoryByEntity = getRepositoryByEntity;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -116,14 +116,26 @@ export function getTimezoneOffset(timezone: string) {
|
|
|
116
116
|
return offset;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
// export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
120
|
+
// entity: EntityTarget<T>,
|
|
121
|
+
// ): Promise<CustomRepository<T>> => {
|
|
122
|
+
// if (!connection) {
|
|
123
|
+
// connection = createDataBaseSource();
|
|
124
|
+
// await connection.initialize();
|
|
125
|
+
// }
|
|
126
|
+
// return connection
|
|
127
|
+
// .getRepository(entity)
|
|
128
|
+
// .extend(CustomRepository.prototype) as CustomRepository<T>;
|
|
129
|
+
// };
|
|
119
130
|
export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
120
131
|
entity: EntityTarget<T>,
|
|
121
132
|
): Promise<CustomRepository<T>> => {
|
|
122
133
|
if (!connection) {
|
|
123
134
|
connection = createDataBaseSource();
|
|
124
135
|
await connection.initialize();
|
|
136
|
+
|
|
137
|
+
console.log(connection.entityMetadatas.map((e) => e.name));
|
|
125
138
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
.extend(CustomRepository.prototype) as CustomRepository<T>;
|
|
139
|
+
|
|
140
|
+
return new CustomRepository<T>(entity, connection);
|
|
129
141
|
};
|