test-entity-library-asm 2.2.4 → 2.2.6
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/entities.views.routes.d.ts +0 -1
- package/dist/entities.views.routes.js +1 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +55 -25
- package/dist/repositories/VerifyLocalRepository.d.ts +4 -2
- package/dist/repositories/VerifyLocalRepository.js +3 -14
- package/package.json +1 -1
- package/src/entities.views.routes.ts +0 -2
- package/src/index.ts +35 -14
- package/src/repositories/VerifyLocalRepository.ts +8 -3
|
@@ -42,4 +42,3 @@ export { BusinessType } from './entities/BusinessType';
|
|
|
42
42
|
export { AuthenticationCredential } from './entities/AuthenticationCredential';
|
|
43
43
|
export { PosSystem } from './entities/PosSystem';
|
|
44
44
|
export { VerifyLocal } from './entities/VerifyLocal';
|
|
45
|
-
export { VerifyLocalRepository } from './repositories/VerifyLocalRepository';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.VerifyLocal = exports.PosSystem = exports.AuthenticationCredential = exports.BusinessType = exports.LocalsCompany = exports.UserAddress = exports.User = exports.TypeMeasureIngredient = exports.TerminalSession = exports.Terminal = exports.Square = exports.RequestStatus = exports.RequestProductGroupComplement = exports.RequestProduct = exports.Request = exports.Region = exports.ProductTopping = exports.ProductIngredient = exports.ProductGroupComplement = exports.ProductGroup = exports.Product = exports.Plan = exports.PaymentMethod = exports.PartnerRole = exports.PartnerPermission = exports.PartnerNotification = exports.Partner = exports.MasterRole = exports.MasterPermission = exports.Master = exports.LocalQualification = exports.Local = exports.DiscountCodeUser = exports.DiscountCodeCompany = exports.Day = exports.Country = exports.Configuration = exports.Company = exports.CodeRedemptionHistoryUser = exports.CodeRedemptionHistoryCompany = exports.City = exports.ScheduleCategory = exports.Category = exports.BusinessTypeProduct = void 0;
|
|
4
4
|
var BusinessTypeProduct_1 = require("./entities/BusinessTypeProduct");
|
|
5
5
|
Object.defineProperty(exports, "BusinessTypeProduct", { enumerable: true, get: function () { return BusinessTypeProduct_1.BusinessTypeProduct; } });
|
|
6
6
|
var Category_1 = require("./entities/Category");
|
|
@@ -89,5 +89,3 @@ var PosSystem_1 = require("./entities/PosSystem");
|
|
|
89
89
|
Object.defineProperty(exports, "PosSystem", { enumerable: true, get: function () { return PosSystem_1.PosSystem; } });
|
|
90
90
|
var VerifyLocal_1 = require("./entities/VerifyLocal");
|
|
91
91
|
Object.defineProperty(exports, "VerifyLocal", { enumerable: true, get: function () { return VerifyLocal_1.VerifyLocal; } });
|
|
92
|
-
var VerifyLocalRepository_1 = require("./repositories/VerifyLocalRepository");
|
|
93
|
-
Object.defineProperty(exports, "VerifyLocalRepository", { enumerable: true, get: function () { return VerifyLocalRepository_1.VerifyLocalRepository; } });
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NextFunction, Request, Response } from 'express';
|
|
2
2
|
import { DataSource, EntityTarget, ObjectLiteral, Repository } from 'typeorm';
|
|
3
|
-
import { VerifyLocalRepository } from '.';
|
|
4
3
|
export * from './entities.views.routes';
|
|
5
4
|
export declare function createDataBaseSource(): DataSource;
|
|
6
5
|
export declare function showEntityNameEntity<T extends ObjectLiteral>(entity: EntityTarget<T>): Promise<Repository<T>>;
|
|
@@ -8,4 +7,5 @@ export declare function showEntity(entityName: string): Promise<any>;
|
|
|
8
7
|
export declare function callStoredProcedure(storedProcedure: any, elements: any): Promise<any>;
|
|
9
8
|
export declare function timezoneMiddleware(req: Request, res: Response, next: NextFunction): void;
|
|
10
9
|
export declare function getTimeZone(): string;
|
|
11
|
-
export declare
|
|
10
|
+
export declare const getRepositoryByEntity: <T extends ObjectLiteral>(entity: EntityTarget<T>) => Promise<Repository<T>>;
|
|
11
|
+
export declare const createCustomRepository: <T extends ObjectLiteral>(entity: EntityTarget<T>, dataSource: DataSource) => Repository<T>;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
2
17
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
18
|
if (k2 === undefined) k2 = k;
|
|
4
19
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -50,12 +65,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
50
65
|
}
|
|
51
66
|
};
|
|
52
67
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.
|
|
68
|
+
exports.createCustomRepository = exports.getRepositoryByEntity = exports.getTimeZone = exports.timezoneMiddleware = exports.callStoredProcedure = exports.showEntity = exports.showEntityNameEntity = exports.createDataBaseSource = void 0;
|
|
54
69
|
var async_hooks_1 = require("async_hooks");
|
|
55
70
|
var dotenv_1 = require("dotenv");
|
|
56
71
|
var path_1 = require("path");
|
|
57
72
|
var typeorm_1 = require("typeorm");
|
|
58
|
-
var _1 = require(".");
|
|
59
73
|
__exportStar(require("./entities.views.routes"), exports);
|
|
60
74
|
var asyncLocalStorage = new async_hooks_1.AsyncLocalStorage();
|
|
61
75
|
var connection = null;
|
|
@@ -172,27 +186,43 @@ function getTimeZone() {
|
|
|
172
186
|
}
|
|
173
187
|
exports.getTimeZone = getTimeZone;
|
|
174
188
|
// Función para obtener repositorios personalizados
|
|
175
|
-
function getRepositoryByName(repositoryName) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
189
|
+
// export async function getRepositoryByName(repositoryName: string) {
|
|
190
|
+
// if (!connection) {
|
|
191
|
+
// connection = createDataBaseSource()
|
|
192
|
+
// await connection.initialize()
|
|
193
|
+
// }
|
|
194
|
+
// switch (repositoryName) {
|
|
195
|
+
// case 'VerifyLocalRepository':
|
|
196
|
+
// return connection.getCustomRepository(VerifyLocalRepository)
|
|
197
|
+
// // return getCustomRepository(VerifyLocalRepository)
|
|
198
|
+
// default:
|
|
199
|
+
// return null
|
|
200
|
+
// }
|
|
201
|
+
// }
|
|
202
|
+
var getRepositoryByEntity = function (entity) { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
+
var dataSource;
|
|
204
|
+
return __generator(this, function (_a) {
|
|
205
|
+
switch (_a.label) {
|
|
206
|
+
case 0:
|
|
207
|
+
dataSource = createDataBaseSource();
|
|
208
|
+
if (!!dataSource.isInitialized) return [3 /*break*/, 2];
|
|
209
|
+
return [4 /*yield*/, dataSource.initialize()];
|
|
210
|
+
case 1:
|
|
211
|
+
_a.sent();
|
|
212
|
+
_a.label = 2;
|
|
213
|
+
case 2: return [2 /*return*/, (0, exports.createCustomRepository)(entity, dataSource)];
|
|
214
|
+
}
|
|
196
215
|
});
|
|
197
|
-
}
|
|
198
|
-
exports.
|
|
216
|
+
}); };
|
|
217
|
+
exports.getRepositoryByEntity = getRepositoryByEntity;
|
|
218
|
+
var createCustomRepository = function (entity, dataSource) {
|
|
219
|
+
var CustomRepository = /** @class */ (function (_super) {
|
|
220
|
+
__extends(CustomRepository, _super);
|
|
221
|
+
function CustomRepository(target, dataSource) {
|
|
222
|
+
return _super.call(this, target, dataSource.manager) || this;
|
|
223
|
+
}
|
|
224
|
+
return CustomRepository;
|
|
225
|
+
}(typeorm_1.Repository));
|
|
226
|
+
return new CustomRepository(entity, dataSource);
|
|
227
|
+
};
|
|
228
|
+
exports.createCustomRepository = createCustomRepository;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
1
|
+
import { Repository, EntityTarget, DataSource } from 'typeorm';
|
|
2
2
|
import { VerifyLocal } from '../entities/VerifyLocal';
|
|
3
|
-
|
|
3
|
+
declare class VerifyLocalRepository extends Repository<VerifyLocal> {
|
|
4
|
+
constructor(target: EntityTarget<VerifyLocal>, dataSource: DataSource);
|
|
4
5
|
getVerifyLocals(status: number | null, page: number, pageSize: number, filters: any): Promise<{
|
|
5
6
|
data: VerifyLocal[];
|
|
6
7
|
total: number;
|
|
@@ -9,3 +10,4 @@ export declare class VerifyLocalRepository extends Repository<VerifyLocal> {
|
|
|
9
10
|
totalPages: number;
|
|
10
11
|
}>;
|
|
11
12
|
}
|
|
13
|
+
export default VerifyLocalRepository;
|
|
@@ -14,12 +14,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -57,13 +51,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
57
51
|
}
|
|
58
52
|
};
|
|
59
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
exports.VerifyLocalRepository = void 0;
|
|
61
54
|
var typeorm_1 = require("typeorm");
|
|
62
|
-
var VerifyLocal_1 = require("../entities/VerifyLocal");
|
|
63
55
|
var VerifyLocalRepository = /** @class */ (function (_super) {
|
|
64
56
|
__extends(VerifyLocalRepository, _super);
|
|
65
|
-
function VerifyLocalRepository() {
|
|
66
|
-
return _super
|
|
57
|
+
function VerifyLocalRepository(target, dataSource) {
|
|
58
|
+
return _super.call(this, target, dataSource.manager) || this;
|
|
67
59
|
}
|
|
68
60
|
VerifyLocalRepository.prototype.getVerifyLocals = function (status, page, pageSize, filters) {
|
|
69
61
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -140,9 +132,6 @@ var VerifyLocalRepository = /** @class */ (function (_super) {
|
|
|
140
132
|
});
|
|
141
133
|
});
|
|
142
134
|
};
|
|
143
|
-
VerifyLocalRepository = __decorate([
|
|
144
|
-
(0, typeorm_1.EntityRepository)(VerifyLocal_1.VerifyLocal)
|
|
145
|
-
], VerifyLocalRepository);
|
|
146
135
|
return VerifyLocalRepository;
|
|
147
136
|
}(typeorm_1.Repository));
|
|
148
|
-
exports.
|
|
137
|
+
exports.default = VerifyLocalRepository;
|
package/package.json
CHANGED
|
@@ -42,5 +42,3 @@ export { BusinessType } from './entities/BusinessType'
|
|
|
42
42
|
export { AuthenticationCredential } from './entities/AuthenticationCredential'
|
|
43
43
|
export { PosSystem } from './entities/PosSystem'
|
|
44
44
|
export { VerifyLocal } from './entities/VerifyLocal'
|
|
45
|
-
|
|
46
|
-
export { VerifyLocalRepository } from './repositories/VerifyLocalRepository'
|
package/src/index.ts
CHANGED
|
@@ -5,12 +5,10 @@ import { resolve } from 'path'
|
|
|
5
5
|
import {
|
|
6
6
|
DataSource,
|
|
7
7
|
EntityTarget,
|
|
8
|
-
getCustomRepository,
|
|
9
8
|
ObjectLiteral,
|
|
10
|
-
Repository
|
|
9
|
+
Repository
|
|
11
10
|
} from 'typeorm'
|
|
12
11
|
import { IType } from './interfaces'
|
|
13
|
-
import { VerifyLocalRepository } from '.'
|
|
14
12
|
export * from './entities.views.routes'
|
|
15
13
|
|
|
16
14
|
const asyncLocalStorage = new AsyncLocalStorage<Map<string, string>>()
|
|
@@ -113,16 +111,39 @@ export function getTimeZone(): string {
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
// Función para obtener repositorios personalizados
|
|
116
|
-
export async function getRepositoryByName(repositoryName: string) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
// export async function getRepositoryByName(repositoryName: string) {
|
|
115
|
+
// if (!connection) {
|
|
116
|
+
// connection = createDataBaseSource()
|
|
117
|
+
// await connection.initialize()
|
|
118
|
+
// }
|
|
119
|
+
|
|
120
|
+
// switch (repositoryName) {
|
|
121
|
+
// case 'VerifyLocalRepository':
|
|
122
|
+
// return connection.getCustomRepository(VerifyLocalRepository)
|
|
123
|
+
// // return getCustomRepository(VerifyLocalRepository)
|
|
124
|
+
// default:
|
|
125
|
+
// return null
|
|
126
|
+
// }
|
|
127
|
+
// }
|
|
128
|
+
|
|
129
|
+
export const getRepositoryByEntity = async <T extends ObjectLiteral>(
|
|
130
|
+
entity: EntityTarget<T>
|
|
131
|
+
): Promise<Repository<T>> => {
|
|
132
|
+
const dataSource = createDataBaseSource();
|
|
133
|
+
if (!dataSource.isInitialized) {
|
|
134
|
+
await dataSource.initialize();
|
|
120
135
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
136
|
+
return createCustomRepository(entity, dataSource);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export const createCustomRepository = <T extends ObjectLiteral>(
|
|
140
|
+
entity: EntityTarget<T>,
|
|
141
|
+
dataSource: DataSource
|
|
142
|
+
): Repository<T> => {
|
|
143
|
+
class CustomRepository extends Repository<T> {
|
|
144
|
+
constructor(target: EntityTarget<T>, dataSource: DataSource) {
|
|
145
|
+
super(target, dataSource.manager);
|
|
146
|
+
}
|
|
127
147
|
}
|
|
128
|
-
|
|
148
|
+
return new CustomRepository(entity, dataSource);
|
|
149
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Repository, EntityTarget, DataSource } from 'typeorm'
|
|
2
2
|
import { VerifyLocal } from '../entities/VerifyLocal'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
class VerifyLocalRepository extends Repository<VerifyLocal> {
|
|
5
|
+
constructor(target: EntityTarget<VerifyLocal>, dataSource: DataSource) {
|
|
6
|
+
super(target, dataSource.manager)
|
|
7
|
+
}
|
|
8
|
+
|
|
6
9
|
async getVerifyLocals(
|
|
7
10
|
status: number | null,
|
|
8
11
|
page: number,
|
|
@@ -102,3 +105,5 @@ export class VerifyLocalRepository extends Repository<VerifyLocal> {
|
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
}
|
|
108
|
+
|
|
109
|
+
export default VerifyLocalRepository
|