@sigmatech/pergamo 0.1.0 → 0.1.2

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.
@@ -11,6 +11,7 @@ export * from './person/person-fiscal-data.entity';
11
11
  export * from './person/person-iio.entity';
12
12
  export * from './person/person-political-data.entity';
13
13
  export * from './person/photo-person.entity';
14
+ export * from './person/photo.entity';
14
15
  export * from './person/person-criminal-data.entity';
15
16
  export * from './person/person-repatriado.entity';
16
17
  export * from './person/person-police-data.entity';
@@ -19,6 +20,12 @@ export * from './person/person-data-telecom.entity';
19
20
  export * from './vehicle/vehicle.entity';
20
21
  export * from './telefonia/telefonia.entity';
21
22
  export * from './telefonia/historial-ubicacion.entity';
23
+ export * from './telefonia/bts.entity';
24
+ export * from './telefonia/location-request.entity';
25
+ export * from './telefonia/location-response.entity';
26
+ export * from './telefonia/m_digitel_2024.entity';
27
+ export * from './telefonia/m_digitel_2025.entity';
28
+ export * from './telefonia/m_movilnet_api_latest.entity';
22
29
  export * from './document/document.entity';
23
30
  export * from './document/document-entity-link.entity';
24
31
  export * from './case/case.entity';
@@ -27,17 +34,28 @@ export * from './case/case-role.entity';
27
34
  export * from './case/case-search.entity';
28
35
  export * from './ipsfa/ipsfa.entity';
29
36
  export * from './inac/detentor.entity';
37
+ export * from './inac/aeronave.entity';
30
38
  export * from './ivss/person-ivss.entity';
31
39
  export * from './ivss/ivss-insured.entity';
40
+ export * from './ivss/ivss-affiliation.entity';
41
+ export * from './ivss/ivss-annual-history.entity';
32
42
  export * from './data-telecom/person-relation-phone.entity';
33
43
  export * from './data-telecom/person-suscriptor-phone.entity';
44
+ export * from './data-telecom/phone.entity';
34
45
  export * from './cpnb/sipolnab.entity';
35
46
  export * from './cpnb/cpnb_general.entity';
36
47
  export * from './criminal/cicpc-solicitados.entity';
37
48
  export * from './comprobacion/maisanta.entity';
38
49
  export * from './comprobacion/revocatorio2016.entity';
50
+ export * from './comprobacion/dbrovp_2018.entity';
39
51
  export * from './repatriados/vuelta-a-la-patria.entity';
40
52
  export * from './notifications/system-notification.entity';
53
+ export * from './notifications/user-notification-read.entity';
54
+ export * from './political/political-party.entity';
55
+ export * from './political/person-political-party.entity';
56
+ export * from './user-profile/user-profile-visit.entity';
57
+ export * from './user-profile/user-search-log.entity';
58
+ export * from './user-profile/user-session-log.entity';
41
59
  export * from './user.entity';
42
60
  export * from './app-config.entity';
43
61
  export * from './audit-log.entity';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC;AAGpD,cAAc,0BAA0B,CAAC;AAGzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AAGvD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AAGvD,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,sBAAsB,CAAC;AAGrC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAG3C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAG9D,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,qC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GvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAGlD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,6BAA6B,CAAC;AAG5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,qCAAqC,CAAC;AAGpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,mCAAmC,CAAC;AAGlD,cAAc,yCAAyC,CAAC;AAGxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,+CAA+C,CAAC;AAG9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,2CAA2C,CAAC;AAG1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AAGvD,cAAc,eAAe,CAAC;AAG9B,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC"}
@@ -29,6 +29,7 @@ __exportStar(require("./person/person-fiscal-data.entity"), exports);
29
29
  __exportStar(require("./person/person-iio.entity"), exports);
30
30
  __exportStar(require("./person/person-political-data.entity"), exports);
31
31
  __exportStar(require("./person/photo-person.entity"), exports);
32
+ __exportStar(require("./person/photo.entity"), exports);
32
33
  __exportStar(require("./person/person-criminal-data.entity"), exports);
33
34
  __exportStar(require("./person/person-repatriado.entity"), exports);
34
35
  __exportStar(require("./person/person-police-data.entity"), exports);
@@ -39,6 +40,12 @@ __exportStar(require("./vehicle/vehicle.entity"), exports);
39
40
  // Telefonia module
40
41
  __exportStar(require("./telefonia/telefonia.entity"), exports);
41
42
  __exportStar(require("./telefonia/historial-ubicacion.entity"), exports);
43
+ __exportStar(require("./telefonia/bts.entity"), exports);
44
+ __exportStar(require("./telefonia/location-request.entity"), exports);
45
+ __exportStar(require("./telefonia/location-response.entity"), exports);
46
+ __exportStar(require("./telefonia/m_digitel_2024.entity"), exports);
47
+ __exportStar(require("./telefonia/m_digitel_2025.entity"), exports);
48
+ __exportStar(require("./telefonia/m_movilnet_api_latest.entity"), exports);
42
49
  // Document module
43
50
  __exportStar(require("./document/document.entity"), exports);
44
51
  __exportStar(require("./document/document-entity-link.entity"), exports);
@@ -51,12 +58,16 @@ __exportStar(require("./case/case-search.entity"), exports);
51
58
  __exportStar(require("./ipsfa/ipsfa.entity"), exports);
52
59
  // INAC module
53
60
  __exportStar(require("./inac/detentor.entity"), exports);
61
+ __exportStar(require("./inac/aeronave.entity"), exports);
54
62
  // IVSS module
55
63
  __exportStar(require("./ivss/person-ivss.entity"), exports);
56
64
  __exportStar(require("./ivss/ivss-insured.entity"), exports);
65
+ __exportStar(require("./ivss/ivss-affiliation.entity"), exports);
66
+ __exportStar(require("./ivss/ivss-annual-history.entity"), exports);
57
67
  // Data Telecom module
58
68
  __exportStar(require("./data-telecom/person-relation-phone.entity"), exports);
59
69
  __exportStar(require("./data-telecom/person-suscriptor-phone.entity"), exports);
70
+ __exportStar(require("./data-telecom/phone.entity"), exports);
60
71
  // CPNB/SIPOLNAB module
61
72
  __exportStar(require("./cpnb/sipolnab.entity"), exports);
62
73
  __exportStar(require("./cpnb/cpnb_general.entity"), exports);
@@ -65,10 +76,19 @@ __exportStar(require("./criminal/cicpc-solicitados.entity"), exports);
65
76
  // Comprobacion module
66
77
  __exportStar(require("./comprobacion/maisanta.entity"), exports);
67
78
  __exportStar(require("./comprobacion/revocatorio2016.entity"), exports);
79
+ __exportStar(require("./comprobacion/dbrovp_2018.entity"), exports);
68
80
  // Repatriados module
69
81
  __exportStar(require("./repatriados/vuelta-a-la-patria.entity"), exports);
70
82
  // Notifications module
71
83
  __exportStar(require("./notifications/system-notification.entity"), exports);
84
+ __exportStar(require("./notifications/user-notification-read.entity"), exports);
85
+ // Political module
86
+ __exportStar(require("./political/political-party.entity"), exports);
87
+ __exportStar(require("./political/person-political-party.entity"), exports);
88
+ // User Profile module
89
+ __exportStar(require("./user-profile/user-profile-visit.entity"), exports);
90
+ __exportStar(require("./user-profile/user-search-log.entity"), exports);
91
+ __exportStar(require("./user-profile/user-session-log.entity"), exports);
72
92
  // User entity
73
93
  __exportStar(require("./user.entity"), exports);
74
94
  // App Config
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;AAEH,gBAAgB;AAChB,+CAA6B;AAC7B,sDAAoC;AAEpC,gBAAgB;AAChB,yDAAuC;AACvC,wEAAsD;AACtD,mEAAiD;AACjD,qEAAmD;AACnD,6DAA2C;AAC3C,wEAAsD;AACtD,+DAA6C;AAC7C,uEAAqD;AACrD,oEAAkD;AAClD,qEAAmD;AACnD,qEAAmD;AACnD,sEAAoD;AAEpD,iBAAiB;AACjB,2DAAyC;AAEzC,mBAAmB;AACnB,+DAA6C;AAC7C,yEAAuD;AAEvD,kBAAkB;AAClB,6DAA2C;AAC3C,yEAAuD;AAEvD,cAAc;AACd,qDAAmC;AACnC,2DAAyC;AACzC,0DAAwC;AACxC,4DAA0C;AAE1C,eAAe;AACf,uDAAqC;AAErC,cAAc;AACd,yDAAuC;AAEvC,cAAc;AACd,4DAA0C;AAC1C,6DAA2C;AAE3C,sBAAsB;AACtB,8EAA4D;AAC5D,gFAA8D;AAE9D,uBAAuB;AACvB,yDAAuC;AACvC,6DAA2C;AAE3C,kBAAkB;AAClB,sEAAoD;AAEpD,sBAAsB;AACtB,iEAA+C;AAC/C,wEAAsD;AAEtD,qBAAqB;AACrB,0EAAwD;AAExD,uBAAuB;AACvB,6EAA2D;AAE3D,cAAc;AACd,gDAA8B;AAE9B,aAAa;AACb,sDAAoC;AAEpC,YAAY;AACZ,qDAAmC;AAEnC,yBAAyB;AACzB,yDAAuC;AACvC,kDAAgC"}
1
+ {"version":3,"file":"index.js","s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kDAAgC"}
@@ -0,0 +1,111 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ import { Phone } from '../data-telecom/phone.entity';
3
+ import { LocationResponse } from './location-response.entity';
4
+ /**
5
+ * Estado de la solicitud de ubicación
6
+ */
7
+ export declare enum LocationRequestStatus {
8
+ PENDING = "pending",
9
+ SENT = "sent",
10
+ WAITING = "waiting",
11
+ PARTIAL = "partial",
12
+ COMPLETED = "completed",
13
+ FAILED = "failed",
14
+ TIMEOUT = "timeout",
15
+ CANCELLED = "cancelled"
16
+ }
17
+ /**
18
+ * Entidad que representa una solicitud de ubicación telefónica
19
+ */
20
+ export declare class LocationRequest extends BaseEntity {
21
+ id: string;
22
+ /**
23
+ * Número telefónico solicitado
24
+ */
25
+ phoneNumber: string;
26
+ /**
27
+ * Relación con la entidad Phone (opcional, si existe en BD)
28
+ */
29
+ phone?: Phone;
30
+ /**
31
+ * ID del usuario que realizó la solicitud
32
+ */
33
+ userId: string;
34
+ /**
35
+ * Tenant ID
36
+ */
37
+ tenant: string;
38
+ /**
39
+ * Estado actual de la solicitud
40
+ */
41
+ status: LocationRequestStatus;
42
+ /**
43
+ * Tipo de comando enviado
44
+ */
45
+ commandType: string;
46
+ /**
47
+ * Prioridad de la solicitud (1-5, siendo 1 la más alta)
48
+ */
49
+ priority: number;
50
+ /**
51
+ * Tiempo estimado de respuesta (en segundos)
52
+ */
53
+ estimatedResponseTime?: number;
54
+ /**
55
+ * Tiempo real de respuesta (en segundos)
56
+ */
57
+ actualResponseTime?: number;
58
+ /**
59
+ * Fecha y hora de envío del SMS
60
+ */
61
+ sentAt?: Date;
62
+ /**
63
+ * Fecha y hora de finalización (éxito o error)
64
+ */
65
+ completedAt?: Date;
66
+ /**
67
+ * Número de intentos de envío
68
+ */
69
+ retryCount: number;
70
+ /**
71
+ * Mensaje de error (si aplica)
72
+ */
73
+ errorMessage?: string;
74
+ /**
75
+ * Metadatos adicionales (JSON)
76
+ */
77
+ metadata?: Record<string, any>;
78
+ /**
79
+ * Dirección IP del solicitante
80
+ */
81
+ ipAddress?: string;
82
+ /**
83
+ * User Agent del solicitante
84
+ */
85
+ userAgent?: string;
86
+ /**
87
+ * Respuestas asociadas a esta solicitud
88
+ */
89
+ responses: LocationResponse[];
90
+ /**
91
+ * Fecha de creación
92
+ */
93
+ createdAt: Date;
94
+ /**
95
+ * Fecha de última actualización
96
+ */
97
+ updatedAt: Date;
98
+ /**
99
+ * Calcula el tiempo de respuesta
100
+ */
101
+ calculateResponseTime(): number | null;
102
+ /**
103
+ * Verifica si la solicitud está en estado final
104
+ */
105
+ isFinalState(): boolean;
106
+ /**
107
+ * Verifica si la solicitud fue exitosa
108
+ */
109
+ isSuccessful(): boolean;
110
+ }
111
+ //# sourceMappingURL=location-request.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-request.entity.d.ts","sourceRoot":"","sources":["../../../src/entities/telefonia/location-request.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAIX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAED;;GAEG;AACH,qBAKa,eAAgB,SAAQ,UAAU;IAE7C,EAAE,EAAG,MAAM,CAAC;IAEZ;;OAEG;IAEH,WAAW,EAAG,MAAM,CAAC;IAErB;;OAEG;IAGH,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;OAEG;IAMH,MAAM,EAAG,qBAAqB,CAAC;IAE/B;;OAEG;IAEH,WAAW,EAAG,MAAM,CAAC;IAErB;;OAEG;IAEH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAEH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IAEH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;OAEG;IAEH,MAAM,CAAC,EAAE,IAAI,CAAC;IAEd;;OAEG;IAEH,WAAW,CAAC,EAAE,IAAI,CAAC;IAEnB;;OAEG;IAEH,UAAU,EAAG,MAAM,CAAC;IAEpB;;OAEG;IAEH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IAIH,SAAS,EAAG,gBAAgB,EAAE,CAAC;IAE/B;;OAEG;IAEH,SAAS,EAAG,IAAI,CAAC;IAEjB;;OAEG;IAEH,SAAS,EAAG,IAAI,CAAC;IAEjB;;OAEG;IACH,qBAAqB,IAAI,MAAM,GAAG,IAAI;IAStC;;OAEG;IACH,YAAY,IAAI,OAAO;IASvB;;OAEG;IACH,YAAY,IAAI,OAAO;CAGxB"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LocationRequest = exports.LocationRequestStatus = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const phone_entity_1 = require("../data-telecom/phone.entity");
15
+ const location_response_entity_1 = require("./location-response.entity");
16
+ /**
17
+ * Estado de la solicitud de ubicación
18
+ */
19
+ var LocationRequestStatus;
20
+ (function (LocationRequestStatus) {
21
+ LocationRequestStatus["PENDING"] = "pending";
22
+ LocationRequestStatus["SENT"] = "sent";
23
+ LocationRequestStatus["WAITING"] = "waiting";
24
+ LocationRequestStatus["PARTIAL"] = "partial";
25
+ LocationRequestStatus["COMPLETED"] = "completed";
26
+ LocationRequestStatus["FAILED"] = "failed";
27
+ LocationRequestStatus["TIMEOUT"] = "timeout";
28
+ LocationRequestStatus["CANCELLED"] = "cancelled";
29
+ })(LocationRequestStatus || (exports.LocationRequestStatus = LocationRequestStatus = {}));
30
+ /**
31
+ * Entidad que representa una solicitud de ubicación telefónica
32
+ */
33
+ let LocationRequest = class LocationRequest extends typeorm_1.BaseEntity {
34
+ /**
35
+ * Calcula el tiempo de respuesta
36
+ */
37
+ calculateResponseTime() {
38
+ if (this.sentAt && this.completedAt) {
39
+ return Math.floor((this.completedAt.getTime() - this.sentAt.getTime()) / 1000);
40
+ }
41
+ return null;
42
+ }
43
+ /**
44
+ * Verifica si la solicitud está en estado final
45
+ */
46
+ isFinalState() {
47
+ return [
48
+ LocationRequestStatus.COMPLETED,
49
+ LocationRequestStatus.FAILED,
50
+ LocationRequestStatus.TIMEOUT,
51
+ LocationRequestStatus.CANCELLED,
52
+ ].includes(this.status);
53
+ }
54
+ /**
55
+ * Verifica si la solicitud fue exitosa
56
+ */
57
+ isSuccessful() {
58
+ return this.status === LocationRequestStatus.COMPLETED;
59
+ }
60
+ };
61
+ exports.LocationRequest = LocationRequest;
62
+ __decorate([
63
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
64
+ __metadata("design:type", String)
65
+ ], LocationRequest.prototype, "id", void 0);
66
+ __decorate([
67
+ (0, typeorm_1.Column)({ type: 'varchar', length: 15, nullable: false }),
68
+ __metadata("design:type", String)
69
+ ], LocationRequest.prototype, "phoneNumber", void 0);
70
+ __decorate([
71
+ (0, typeorm_1.ManyToOne)(() => phone_entity_1.Phone, { nullable: true, eager: false }),
72
+ (0, typeorm_1.JoinColumn)({ name: 'phone_id' }),
73
+ __metadata("design:type", phone_entity_1.Phone)
74
+ ], LocationRequest.prototype, "phone", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'uuid', nullable: false }),
77
+ __metadata("design:type", String)
78
+ ], LocationRequest.prototype, "userId", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, nullable: false, default: 'sp3' }),
81
+ __metadata("design:type", String)
82
+ ], LocationRequest.prototype, "tenant", void 0);
83
+ __decorate([
84
+ (0, typeorm_1.Column)({
85
+ type: 'enum',
86
+ enum: LocationRequestStatus,
87
+ default: LocationRequestStatus.PENDING,
88
+ }),
89
+ __metadata("design:type", String)
90
+ ], LocationRequest.prototype, "status", void 0);
91
+ __decorate([
92
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, default: '734' }),
93
+ __metadata("design:type", String)
94
+ ], LocationRequest.prototype, "commandType", void 0);
95
+ __decorate([
96
+ (0, typeorm_1.Column)({ type: 'int', default: 3 }),
97
+ __metadata("design:type", Number)
98
+ ], LocationRequest.prototype, "priority", void 0);
99
+ __decorate([
100
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
101
+ __metadata("design:type", Number)
102
+ ], LocationRequest.prototype, "estimatedResponseTime", void 0);
103
+ __decorate([
104
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
105
+ __metadata("design:type", Number)
106
+ ], LocationRequest.prototype, "actualResponseTime", void 0);
107
+ __decorate([
108
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
109
+ __metadata("design:type", Date)
110
+ ], LocationRequest.prototype, "sentAt", void 0);
111
+ __decorate([
112
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
113
+ __metadata("design:type", Date)
114
+ ], LocationRequest.prototype, "completedAt", void 0);
115
+ __decorate([
116
+ (0, typeorm_1.Column)({ type: 'int', default: 0 }),
117
+ __metadata("design:type", Number)
118
+ ], LocationRequest.prototype, "retryCount", void 0);
119
+ __decorate([
120
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
121
+ __metadata("design:type", String)
122
+ ], LocationRequest.prototype, "errorMessage", void 0);
123
+ __decorate([
124
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
125
+ __metadata("design:type", Object)
126
+ ], LocationRequest.prototype, "metadata", void 0);
127
+ __decorate([
128
+ (0, typeorm_1.Column)({ type: 'varchar', length: 45, nullable: true }),
129
+ __metadata("design:type", String)
130
+ ], LocationRequest.prototype, "ipAddress", void 0);
131
+ __decorate([
132
+ (0, typeorm_1.Column)({ type: 'varchar', length: 255, nullable: true }),
133
+ __metadata("design:type", String)
134
+ ], LocationRequest.prototype, "userAgent", void 0);
135
+ __decorate([
136
+ (0, typeorm_1.OneToMany)(() => location_response_entity_1.LocationResponse, (response) => response.request, {
137
+ cascade: true,
138
+ }),
139
+ __metadata("design:type", Array)
140
+ ], LocationRequest.prototype, "responses", void 0);
141
+ __decorate([
142
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
143
+ __metadata("design:type", Date)
144
+ ], LocationRequest.prototype, "createdAt", void 0);
145
+ __decorate([
146
+ (0, typeorm_1.UpdateDateColumn)({ type: 'timestamp' }),
147
+ __metadata("design:type", Date)
148
+ ], LocationRequest.prototype, "updatedAt", void 0);
149
+ exports.LocationRequest = LocationRequest = __decorate([
150
+ (0, typeorm_1.Entity)({ name: 'location_requests' }),
151
+ (0, typeorm_1.Index)('idx_location_request_phone', ['phoneNumber']),
152
+ (0, typeorm_1.Index)('idx_location_request_status', ['status']),
153
+ (0, typeorm_1.Index)('idx_location_request_user', ['userId']),
154
+ (0, typeorm_1.Index)('idx_location_request_created', ['createdAt'])
155
+ ], LocationRequest);
156
+ //# sourceMappingURL=location-request.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-request.entity.js","sourceRoot":"","sources":["../../../src/entities/telefonia/location-request.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAWiB;AACjB,+DAAqD;AACrD,yEAA8D;AAE9D;;GAEG;AACH,IAAY,qBASX;AATD,WAAY,qBAAqB;IAC/B,4CAAmB,CAAA;IACnB,sCAAa,CAAA;IACb,4CAAmB,CAAA;IACnB,4CAAmB,CAAA;IACnB,gDAAuB,CAAA;IACvB,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,gDAAuB,CAAA;AACzB,CAAC,EATW,qBAAqB,qCAArB,qBAAqB,QAShC;AAED;;GAEG;AAMI,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,oBAAU;IA6H7C;;OAEG;IACH,qBAAqB;QACnB,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACpC,OAAO,IAAI,CAAC,KAAK,CACf,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAC5D,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO;YACL,qBAAqB,CAAC,SAAS;YAC/B,qBAAqB,CAAC,MAAM;YAC5B,qBAAqB,CAAC,OAAO;YAC7B,qBAAqB,CAAC,SAAS;SAChC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,MAAM,KAAK,qBAAqB,CAAC,SAAS,CAAC;IACzD,CAAC;CACF,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CAAC,aAAa,CAAC,CAAC;IACpD,IAAA,eAAK,EAAC,6BAA6B,EAAE,CAAC,QAAQ,CAAC,CAAC;IAChD,IAAA,eAAK,EAAC,2BAA2B,EAAE,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAA,eAAK,EAAC,8BAA8B,EAAE,CAAC,WAAW,CAAC,CAAC;GACxC,eAAe,CA2J3B"}
@@ -0,0 +1,129 @@
1
+ import { BaseEntity } from 'typeorm';
2
+ import { Point } from 'geojson';
3
+ import { LocationRequest } from './location-request.entity';
4
+ import { BTS } from './bts.entity';
5
+ /**
6
+ * Tipo de respuesta de ubicación
7
+ */
8
+ export declare enum LocationResponseType {
9
+ COMPLETE = "complete",// Respuesta completa con GPS
10
+ PARTIAL = "partial",// Solo BTS, sin GPS
11
+ ERROR = "error"
12
+ }
13
+ /**
14
+ * Entidad que representa la respuesta de ubicación de un teléfono
15
+ */
16
+ export declare class LocationResponse extends BaseEntity {
17
+ id: string;
18
+ /**
19
+ * Relación con la solicitud de ubicación
20
+ */
21
+ request: LocationRequest;
22
+ /**
23
+ * Número telefónico (desnormalizado para consultas rápidas)
24
+ */
25
+ phoneNumber: string;
26
+ /**
27
+ * Tipo de respuesta
28
+ */
29
+ responseType: LocationResponseType;
30
+ /**
31
+ * Coordenadas GPS (si están disponibles)
32
+ * Formato: POINT(longitude latitude)
33
+ */
34
+ coordinates?: Point;
35
+ /**
36
+ * Latitud (desnormalizado para facilitar consultas)
37
+ */
38
+ latitude?: number;
39
+ /**
40
+ * Longitud (desnormalizado para facilitar consultas)
41
+ */
42
+ longitude?: number;
43
+ /**
44
+ * Dirección textual aproximada
45
+ */
46
+ address?: string;
47
+ /**
48
+ * Orientación cardinal (N, S, E, O, NE, etc.)
49
+ */
50
+ orientation?: string;
51
+ /**
52
+ * Grados de orientación (0-360)
53
+ */
54
+ degrees?: number;
55
+ /**
56
+ * Relación con BTS (antena celular)
57
+ */
58
+ bts?: BTS;
59
+ /**
60
+ * Cell ID (desnormalizado)
61
+ */
62
+ cellId?: string;
63
+ /**
64
+ * Nombre de la celda/antena
65
+ */
66
+ cellName?: string;
67
+ /**
68
+ * Radio de cobertura estimado (en metros)
69
+ */
70
+ coverageRadius?: number;
71
+ /**
72
+ * Precisión de la ubicación (en metros)
73
+ */
74
+ accuracy?: number;
75
+ /**
76
+ * Tecnología de red (2G, 3G, 4G, 5G)
77
+ */
78
+ networkType?: string;
79
+ /**
80
+ * Operadora
81
+ */
82
+ carrier: string;
83
+ /**
84
+ * Fecha y hora reportada en el SMS
85
+ */
86
+ reportedAt?: Date;
87
+ /**
88
+ * Fecha y hora de recepción del SMS
89
+ */
90
+ receivedAt: Date;
91
+ /**
92
+ * Número de parte del mensaje (para SMS multiparte)
93
+ */
94
+ messagePart: number;
95
+ /**
96
+ * Total de partes del mensaje
97
+ */
98
+ totalParts: number;
99
+ /**
100
+ * Contenido crudo del SMS recibido
101
+ */
102
+ rawMessage?: string;
103
+ /**
104
+ * Mensajes completos (para multiparte)
105
+ */
106
+ rawMessages?: Record<string, string>;
107
+ /**
108
+ * Metadatos adicionales
109
+ */
110
+ metadata?: Record<string, any>;
111
+ /**
112
+ * Fecha de creación del registro
113
+ */
114
+ createdAt: Date;
115
+ /**
116
+ * Calcula la distancia desde un punto dado (en metros)
117
+ * Usa la fórmula de Haversine
118
+ */
119
+ calculateDistance(lat: number, lon: number): number | null;
120
+ /**
121
+ * Verifica si la respuesta está completa (tiene coordenadas GPS)
122
+ */
123
+ isComplete(): boolean;
124
+ /**
125
+ * Verifica si es una respuesta parcial (solo BTS)
126
+ */
127
+ isPartial(): boolean;
128
+ }
129
+ //# sourceMappingURL=location-response.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-response.entity.d.ts","sourceRoot":"","sources":["../../../src/entities/telefonia/location-response.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,UAAU,EAGX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;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EG;IAEH,UAAU,EAAG,MAAM,CAAC;IAEpB;;OAEG;IAEH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IAEH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAErC;;OAEG;IAEH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE/B;;OAEG;IAEH,SAAS,EAAG,IAAI,CAAC;IAEjB;;;OAGG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkB1D;;OAEG;IACH,UAAU,IAAI,OAAO;IAQrB;;OAEG;IACH,SAAS,IAAI,OAAO;CAMrB"}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.LocationResponse = exports.LocationResponseType = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const location_request_entity_1 = require("./location-request.entity");
15
+ const bts_entity_1 = require("./bts.entity");
16
+ /**
17
+ * Tipo de respuesta de ubicación
18
+ */
19
+ var LocationResponseType;
20
+ (function (LocationResponseType) {
21
+ LocationResponseType["COMPLETE"] = "complete";
22
+ LocationResponseType["PARTIAL"] = "partial";
23
+ LocationResponseType["ERROR"] = "error";
24
+ })(LocationResponseType || (exports.LocationResponseType = LocationResponseType = {}));
25
+ /**
26
+ * Entidad que representa la respuesta de ubicación de un teléfono
27
+ */
28
+ let LocationResponse = class LocationResponse extends typeorm_1.BaseEntity {
29
+ /**
30
+ * Calcula la distancia desde un punto dado (en metros)
31
+ * Usa la fórmula de Haversine
32
+ */
33
+ calculateDistance(lat, lon) {
34
+ if (!this.latitude || !this.longitude)
35
+ return null;
36
+ const R = 6371e3; // Radio de la Tierra en metros
37
+ const φ1 = (this.latitude * Math.PI) / 180;
38
+ const φ2 = (lat * Math.PI) / 180;
39
+ const Δφ = ((lat - this.latitude) * Math.PI) / 180;
40
+ const Δλ = ((lon - this.longitude) * Math.PI) / 180;
41
+ const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
42
+ Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
43
+ const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
44
+ return R * c;
45
+ }
46
+ /**
47
+ * Verifica si la respuesta está completa (tiene coordenadas GPS)
48
+ */
49
+ isComplete() {
50
+ return (this.responseType === LocationResponseType.COMPLETE &&
51
+ this.latitude !== null &&
52
+ this.longitude !== null);
53
+ }
54
+ /**
55
+ * Verifica si es una respuesta parcial (solo BTS)
56
+ */
57
+ isPartial() {
58
+ return (this.responseType === LocationResponseType.PARTIAL ||
59
+ (this.cellId !== null && this.latitude === null));
60
+ }
61
+ };
62
+ exports.LocationResponse = LocationResponse;
63
+ __decorate([
64
+ (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
65
+ __metadata("design:type", String)
66
+ ], LocationResponse.prototype, "id", void 0);
67
+ __decorate([
68
+ (0, typeorm_1.ManyToOne)(() => location_request_entity_1.LocationRequest, (request) => request.responses, {
69
+ nullable: false,
70
+ onDelete: 'CASCADE',
71
+ }),
72
+ (0, typeorm_1.JoinColumn)({ name: 'request_id' }),
73
+ __metadata("design:type", location_request_entity_1.LocationRequest)
74
+ ], LocationResponse.prototype, "request", void 0);
75
+ __decorate([
76
+ (0, typeorm_1.Column)({ type: 'varchar', length: 15, nullable: false }),
77
+ __metadata("design:type", String)
78
+ ], LocationResponse.prototype, "phoneNumber", void 0);
79
+ __decorate([
80
+ (0, typeorm_1.Column)({
81
+ type: 'enum',
82
+ enum: LocationResponseType,
83
+ default: LocationResponseType.COMPLETE,
84
+ }),
85
+ __metadata("design:type", String)
86
+ ], LocationResponse.prototype, "responseType", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)({
89
+ type: 'geometry',
90
+ spatialFeatureType: 'Point',
91
+ srid: 4326,
92
+ nullable: true,
93
+ }),
94
+ __metadata("design:type", Object)
95
+ ], LocationResponse.prototype, "coordinates", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 7, nullable: true }),
98
+ __metadata("design:type", Number)
99
+ ], LocationResponse.prototype, "latitude", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.Column)({ type: 'decimal', precision: 10, scale: 7, nullable: true }),
102
+ __metadata("design:type", Number)
103
+ ], LocationResponse.prototype, "longitude", void 0);
104
+ __decorate([
105
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
106
+ __metadata("design:type", String)
107
+ ], LocationResponse.prototype, "address", void 0);
108
+ __decorate([
109
+ (0, typeorm_1.Column)({ type: 'varchar', length: 10, nullable: true }),
110
+ __metadata("design:type", String)
111
+ ], LocationResponse.prototype, "orientation", void 0);
112
+ __decorate([
113
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
114
+ __metadata("design:type", Number)
115
+ ], LocationResponse.prototype, "degrees", void 0);
116
+ __decorate([
117
+ (0, typeorm_1.ManyToOne)(() => bts_entity_1.BTS, { nullable: true, eager: true }),
118
+ (0, typeorm_1.JoinColumn)({ name: 'bts_id' }),
119
+ __metadata("design:type", bts_entity_1.BTS)
120
+ ], LocationResponse.prototype, "bts", void 0);
121
+ __decorate([
122
+ (0, typeorm_1.Column)({ type: 'varchar', length: 20, nullable: true }),
123
+ __metadata("design:type", String)
124
+ ], LocationResponse.prototype, "cellId", void 0);
125
+ __decorate([
126
+ (0, typeorm_1.Column)({ type: 'varchar', length: 100, nullable: true }),
127
+ __metadata("design:type", String)
128
+ ], LocationResponse.prototype, "cellName", void 0);
129
+ __decorate([
130
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
131
+ __metadata("design:type", Number)
132
+ ], LocationResponse.prototype, "coverageRadius", void 0);
133
+ __decorate([
134
+ (0, typeorm_1.Column)({ type: 'int', nullable: true }),
135
+ __metadata("design:type", Number)
136
+ ], LocationResponse.prototype, "accuracy", void 0);
137
+ __decorate([
138
+ (0, typeorm_1.Column)({ type: 'varchar', length: 10, nullable: true }),
139
+ __metadata("design:type", String)
140
+ ], LocationResponse.prototype, "networkType", void 0);
141
+ __decorate([
142
+ (0, typeorm_1.Column)({ type: 'varchar', length: 50, default: 'Digitel' }),
143
+ __metadata("design:type", String)
144
+ ], LocationResponse.prototype, "carrier", void 0);
145
+ __decorate([
146
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: true }),
147
+ __metadata("design:type", Date)
148
+ ], LocationResponse.prototype, "reportedAt", void 0);
149
+ __decorate([
150
+ (0, typeorm_1.Column)({ type: 'timestamp', nullable: false }),
151
+ __metadata("design:type", Date)
152
+ ], LocationResponse.prototype, "receivedAt", void 0);
153
+ __decorate([
154
+ (0, typeorm_1.Column)({ type: 'int', default: 1 }),
155
+ __metadata("design:type", Number)
156
+ ], LocationResponse.prototype, "messagePart", void 0);
157
+ __decorate([
158
+ (0, typeorm_1.Column)({ type: 'int', default: 1 }),
159
+ __metadata("design:type", Number)
160
+ ], LocationResponse.prototype, "totalParts", void 0);
161
+ __decorate([
162
+ (0, typeorm_1.Column)({ type: 'text', nullable: true }),
163
+ __metadata("design:type", String)
164
+ ], LocationResponse.prototype, "rawMessage", void 0);
165
+ __decorate([
166
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
167
+ __metadata("design:type", Object)
168
+ ], LocationResponse.prototype, "rawMessages", void 0);
169
+ __decorate([
170
+ (0, typeorm_1.Column)({ type: 'jsonb', nullable: true }),
171
+ __metadata("design:type", Object)
172
+ ], LocationResponse.prototype, "metadata", void 0);
173
+ __decorate([
174
+ (0, typeorm_1.CreateDateColumn)({ type: 'timestamp' }),
175
+ __metadata("design:type", Date)
176
+ ], LocationResponse.prototype, "createdAt", void 0);
177
+ exports.LocationResponse = LocationResponse = __decorate([
178
+ (0, typeorm_1.Entity)({ name: 'location_responses' }),
179
+ (0, typeorm_1.Index)('idx_location_response_request', ['request']),
180
+ (0, typeorm_1.Index)('idx_location_response_phone', ['phoneNumber']),
181
+ (0, typeorm_1.Index)('idx_location_response_bts', ['bts']),
182
+ (0, typeorm_1.Index)('idx_location_response_received', ['receivedAt']),
183
+ (0, typeorm_1.Index)('idx_location_response_geom', ['coordinates'], { spatial: true })
184
+ ], LocationResponse);
185
+ //# sourceMappingURL=location-response.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"location-response.entity.js","sourceRoot":"","sources":["../../../src/entities/telefonia/location-response.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCASiB;AAEjB,uEAA4D;AAC5D,6CAAmC;AAEnC;;GAEG;AACH,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,6CAAqB,CAAA;IACrB,2CAAmB,CAAA;IACnB,uCAAe,CAAA;AACjB,CAAC,EAJW,oBAAoB,oCAApB,oBAAoB,QAI/B;AAED;;GAEG;AAOI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,oBAAU;IAmK9C;;;OAGG;IACH,iBAAiB,CAAC,GAAW,EAAE,GAAW;QACxC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAEnD,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,+BAA+B;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6 @@
1
1
  {
2
2
  "name": "@sigmatech/pergamo",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Shared TypeORM entities and utilities for Dataven intelligence system - Named after the ancient library of Pergamon",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",