@fiado/api-invoker 5.144.0 → 5.145.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.
- package/bin/index.d.ts +1 -0
- package/bin/index.js +1 -0
- package/bin/motosafeConnector/api/MotosafeConnectorApi.d.ts +17 -0
- package/bin/motosafeConnector/api/MotosafeConnectorApi.js +50 -0
- package/bin/motosafeConnector/api/interfaces/IMotosafeConnectorApi.d.ts +19 -0
- package/bin/motosafeConnector/api/interfaces/IMotosafeConnectorApi.js +1 -0
- package/bin/motosafeConnector/index.d.ts +2 -0
- package/bin/motosafeConnector/index.js +2 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/motosafeConnector/api/MotosafeConnectorApi.ts +73 -0
- package/src/motosafeConnector/api/interfaces/IMotosafeConnectorApi.ts +57 -0
- package/src/motosafeConnector/index.ts +2 -0
package/bin/index.d.ts
CHANGED
|
@@ -127,6 +127,7 @@ export * from "./domain-callback/index.js";
|
|
|
127
127
|
export * from "./datacultrConnector/index.js";
|
|
128
128
|
export * from "./webhook-business/index.js";
|
|
129
129
|
export * from "./trustonicConnector/index.js";
|
|
130
|
+
export * from "./motosafeConnector/index.js";
|
|
130
131
|
export * from "./rewards-business/index.js";
|
|
131
132
|
export * from "./rewards-eligibility-business/index.js";
|
|
132
133
|
export * from "./rules-business/index.js";
|
package/bin/index.js
CHANGED
|
@@ -127,6 +127,7 @@ export * from "./domain-callback/index.js";
|
|
|
127
127
|
export * from "./datacultrConnector/index.js";
|
|
128
128
|
export * from "./webhook-business/index.js";
|
|
129
129
|
export * from "./trustonicConnector/index.js";
|
|
130
|
+
export * from "./motosafeConnector/index.js";
|
|
130
131
|
export * from "./rewards-business/index.js";
|
|
131
132
|
export * from "./rewards-eligibility-business/index.js";
|
|
132
133
|
export * from "./rules-business/index.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
+
import { DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceLockRequest, DeviceLockResponse, DeviceNotifyRequest, DeviceNotifyResponse, DeviceReleaseInitiateResponse, DeviceReleaseRequest, DeviceReleaseStatusRequest, DeviceReleaseStatusResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
4
|
+
import { DeviceBatchRequest, DeviceBatchResult } from "../../utils/MdmEnvelopes.js";
|
|
5
|
+
import { IMotosafeConnectorApi } from "./interfaces/IMotosafeConnectorApi.js";
|
|
6
|
+
export default class MotosafeConnectorApi implements IMotosafeConnectorApi {
|
|
7
|
+
private httpRequest;
|
|
8
|
+
private readonly baseUrl;
|
|
9
|
+
constructor(httpRequest: IHttpRequest);
|
|
10
|
+
enrollDevices(input: DeviceBatchRequest<DeviceEnrollRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceEnrollInitiateResponse>>>;
|
|
11
|
+
getStatus(input: DeviceBatchRequest<DeviceStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceStatusResponse>>>;
|
|
12
|
+
lockDevices(input: DeviceBatchRequest<DeviceLockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceLockResponse>>>;
|
|
13
|
+
unlockDevices(input: DeviceBatchRequest<DeviceUnlockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceUnlockResponse>>>;
|
|
14
|
+
releaseDevices(input: DeviceBatchRequest<DeviceReleaseRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
15
|
+
releaseStatus(input: DeviceBatchRequest<DeviceReleaseStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
16
|
+
notifyDevices(input: DeviceBatchRequest<DeviceNotifyRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
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;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
// Publisher HTTP de `motosafe-connector`. El consumidor define
|
|
15
|
+
// MOTOSAFE_CONNECTOR_URL: '{{resolve:ssm:motosafe-connector}}' en su template.yml.
|
|
16
|
+
let MotosafeConnectorApi = class MotosafeConnectorApi {
|
|
17
|
+
httpRequest;
|
|
18
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//devices".
|
|
19
|
+
baseUrl = (process.env.MOTOSAFE_CONNECTOR_URL || "").replace(/\/+$/, "");
|
|
20
|
+
constructor(httpRequest) {
|
|
21
|
+
this.httpRequest = httpRequest;
|
|
22
|
+
}
|
|
23
|
+
async enrollDevices(input) {
|
|
24
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/enroll`, input);
|
|
25
|
+
}
|
|
26
|
+
async getStatus(input) {
|
|
27
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/status`, input);
|
|
28
|
+
}
|
|
29
|
+
async lockDevices(input) {
|
|
30
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/lock`, input);
|
|
31
|
+
}
|
|
32
|
+
async unlockDevices(input) {
|
|
33
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/unlock`, input);
|
|
34
|
+
}
|
|
35
|
+
async releaseDevices(input) {
|
|
36
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release`, input);
|
|
37
|
+
}
|
|
38
|
+
async releaseStatus(input) {
|
|
39
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release/status`, input);
|
|
40
|
+
}
|
|
41
|
+
async notifyDevices(input) {
|
|
42
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/notify`, input);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
MotosafeConnectorApi = __decorate([
|
|
46
|
+
injectable(),
|
|
47
|
+
__param(0, inject("IHttpRequest")),
|
|
48
|
+
__metadata("design:paramtypes", [Object])
|
|
49
|
+
], MotosafeConnectorApi);
|
|
50
|
+
export default MotosafeConnectorApi;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import { DeviceEnrollInitiateResponse, DeviceEnrollRequest, DeviceLockRequest, DeviceLockResponse, DeviceNotifyRequest, DeviceNotifyResponse, DeviceReleaseInitiateResponse, DeviceReleaseRequest, DeviceReleaseStatusRequest, DeviceReleaseStatusResponse, DeviceStatusRequest, DeviceStatusResponse, DeviceUnlockRequest, DeviceUnlockResponse } from "@fiado/type-kit/bin/mdm/index.js";
|
|
3
|
+
import { DeviceBatchRequest, DeviceBatchResult } from "../../../utils/MdmEnvelopes.js";
|
|
4
|
+
export interface IMotosafeConnectorApi {
|
|
5
|
+
/** POST `/devices/enroll` — registra cada IMEI; responde `PENDING` sin `pollingHandle` (se concilia por estado). */
|
|
6
|
+
enrollDevices(input: DeviceBatchRequest<DeviceEnrollRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceEnrollInitiateResponse>>>;
|
|
7
|
+
/** POST `/devices/status` — estado aplicado de cada IMEI; `UNKNOWN` si la orden aún no llega al equipo. */
|
|
8
|
+
getStatus(input: DeviceBatchRequest<DeviceStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceStatusResponse>>>;
|
|
9
|
+
/** POST `/devices/lock` — bloqueo inmediato, sin mensaje en pantalla. */
|
|
10
|
+
lockDevices(input: DeviceBatchRequest<DeviceLockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceLockResponse>>>;
|
|
11
|
+
/** POST `/devices/unlock` — desbloqueo inmediato; rechaza `unlockUntil` (solo ONDEMAND). */
|
|
12
|
+
unlockDevices(input: DeviceBatchRequest<DeviceUnlockRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceUnlockResponse>>>;
|
|
13
|
+
/** POST `/devices/release` — libera cada IMEI; responde `PENDING` y se confirma con `releaseStatus`. */
|
|
14
|
+
releaseDevices(input: DeviceBatchRequest<DeviceReleaseRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
15
|
+
/** POST `/devices/release/status` — `SUCCESS` solo si el estado indica liberación; sin `pollingHandle`. */
|
|
16
|
+
releaseStatus(input: DeviceBatchRequest<DeviceReleaseStatusRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
17
|
+
/** POST `/devices/notify` — aviso en pantalla; título ≤ 30 y contenido ≤ 100 caracteres. */
|
|
18
|
+
notifyDevices(input: DeviceBatchRequest<DeviceNotifyRequest>): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.145.0",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
package/src/index.ts
CHANGED
|
@@ -127,6 +127,7 @@ export * from "./domain-callback/index.js";
|
|
|
127
127
|
export * from "./datacultrConnector/index.js";
|
|
128
128
|
export * from "./webhook-business/index.js";
|
|
129
129
|
export * from "./trustonicConnector/index.js";
|
|
130
|
+
export * from "./motosafeConnector/index.js";
|
|
130
131
|
export * from "./rewards-business/index.js";
|
|
131
132
|
export * from "./rewards-eligibility-business/index.js";
|
|
132
133
|
export * from "./rules-business/index.js";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { inject, injectable } from "inversify";
|
|
2
|
+
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
+
import {
|
|
5
|
+
DeviceEnrollInitiateResponse,
|
|
6
|
+
DeviceEnrollRequest,
|
|
7
|
+
DeviceLockRequest,
|
|
8
|
+
DeviceLockResponse,
|
|
9
|
+
DeviceNotifyRequest,
|
|
10
|
+
DeviceNotifyResponse,
|
|
11
|
+
DeviceReleaseInitiateResponse,
|
|
12
|
+
DeviceReleaseRequest,
|
|
13
|
+
DeviceReleaseStatusRequest,
|
|
14
|
+
DeviceReleaseStatusResponse,
|
|
15
|
+
DeviceStatusRequest,
|
|
16
|
+
DeviceStatusResponse,
|
|
17
|
+
DeviceUnlockRequest,
|
|
18
|
+
DeviceUnlockResponse,
|
|
19
|
+
} from "@fiado/type-kit/bin/mdm/index.js";
|
|
20
|
+
import { DeviceBatchRequest, DeviceBatchResult } from "../../utils/MdmEnvelopes.js";
|
|
21
|
+
import { IMotosafeConnectorApi } from "./interfaces/IMotosafeConnectorApi.js";
|
|
22
|
+
|
|
23
|
+
// Publisher HTTP de `motosafe-connector`. El consumidor define
|
|
24
|
+
// MOTOSAFE_CONNECTOR_URL: '{{resolve:ssm:motosafe-connector}}' en su template.yml.
|
|
25
|
+
@injectable()
|
|
26
|
+
export default class MotosafeConnectorApi implements IMotosafeConnectorApi {
|
|
27
|
+
// El buildspec publica la URL en SSM con "/" final; se normaliza para no armar "//devices".
|
|
28
|
+
private readonly baseUrl = (process.env.MOTOSAFE_CONNECTOR_URL || "").replace(/\/+$/, "");
|
|
29
|
+
|
|
30
|
+
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
31
|
+
|
|
32
|
+
async enrollDevices(
|
|
33
|
+
input: DeviceBatchRequest<DeviceEnrollRequest>,
|
|
34
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceEnrollInitiateResponse>>> {
|
|
35
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/enroll`, input);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async getStatus(
|
|
39
|
+
input: DeviceBatchRequest<DeviceStatusRequest>,
|
|
40
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceStatusResponse>>> {
|
|
41
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/status`, input);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async lockDevices(
|
|
45
|
+
input: DeviceBatchRequest<DeviceLockRequest>,
|
|
46
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceLockResponse>>> {
|
|
47
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/lock`, input);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
async unlockDevices(
|
|
51
|
+
input: DeviceBatchRequest<DeviceUnlockRequest>,
|
|
52
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceUnlockResponse>>> {
|
|
53
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/unlock`, input);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async releaseDevices(
|
|
57
|
+
input: DeviceBatchRequest<DeviceReleaseRequest>,
|
|
58
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>> {
|
|
59
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release`, input);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async releaseStatus(
|
|
63
|
+
input: DeviceBatchRequest<DeviceReleaseStatusRequest>,
|
|
64
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>> {
|
|
65
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/release/status`, input);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async notifyDevices(
|
|
69
|
+
input: DeviceBatchRequest<DeviceNotifyRequest>,
|
|
70
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>> {
|
|
71
|
+
return await this.httpRequest.post(`${this.baseUrl}/devices/notify`, input);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
+
import {
|
|
3
|
+
DeviceEnrollInitiateResponse,
|
|
4
|
+
DeviceEnrollRequest,
|
|
5
|
+
DeviceLockRequest,
|
|
6
|
+
DeviceLockResponse,
|
|
7
|
+
DeviceNotifyRequest,
|
|
8
|
+
DeviceNotifyResponse,
|
|
9
|
+
DeviceReleaseInitiateResponse,
|
|
10
|
+
DeviceReleaseRequest,
|
|
11
|
+
DeviceReleaseStatusRequest,
|
|
12
|
+
DeviceReleaseStatusResponse,
|
|
13
|
+
DeviceStatusRequest,
|
|
14
|
+
DeviceStatusResponse,
|
|
15
|
+
DeviceUnlockRequest,
|
|
16
|
+
DeviceUnlockResponse,
|
|
17
|
+
} from "@fiado/type-kit/bin/mdm/index.js";
|
|
18
|
+
import { DeviceBatchRequest, DeviceBatchResult } from "../../../utils/MdmEnvelopes.js";
|
|
19
|
+
|
|
20
|
+
// Publisher de `motosafe-connector`: paths `/devices/*` sin `/private`, sin tenant, `Feature.ANONIMUS` (VPC).
|
|
21
|
+
// Solo los 7 métodos que llama algún consumidor; el resto lo degrada el adapter sin salir a la red.
|
|
22
|
+
export interface IMotosafeConnectorApi {
|
|
23
|
+
/** POST `/devices/enroll` — registra cada IMEI; responde `PENDING` sin `pollingHandle` (se concilia por estado). */
|
|
24
|
+
enrollDevices(
|
|
25
|
+
input: DeviceBatchRequest<DeviceEnrollRequest>,
|
|
26
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceEnrollInitiateResponse>>>;
|
|
27
|
+
|
|
28
|
+
/** POST `/devices/status` — estado aplicado de cada IMEI; `UNKNOWN` si la orden aún no llega al equipo. */
|
|
29
|
+
getStatus(
|
|
30
|
+
input: DeviceBatchRequest<DeviceStatusRequest>,
|
|
31
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceStatusResponse>>>;
|
|
32
|
+
|
|
33
|
+
/** POST `/devices/lock` — bloqueo inmediato, sin mensaje en pantalla. */
|
|
34
|
+
lockDevices(
|
|
35
|
+
input: DeviceBatchRequest<DeviceLockRequest>,
|
|
36
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceLockResponse>>>;
|
|
37
|
+
|
|
38
|
+
/** POST `/devices/unlock` — desbloqueo inmediato; rechaza `unlockUntil` (solo ONDEMAND). */
|
|
39
|
+
unlockDevices(
|
|
40
|
+
input: DeviceBatchRequest<DeviceUnlockRequest>,
|
|
41
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceUnlockResponse>>>;
|
|
42
|
+
|
|
43
|
+
/** POST `/devices/release` — libera cada IMEI; responde `PENDING` y se confirma con `releaseStatus`. */
|
|
44
|
+
releaseDevices(
|
|
45
|
+
input: DeviceBatchRequest<DeviceReleaseRequest>,
|
|
46
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseInitiateResponse>>>;
|
|
47
|
+
|
|
48
|
+
/** POST `/devices/release/status` — `SUCCESS` solo si el estado indica liberación; sin `pollingHandle`. */
|
|
49
|
+
releaseStatus(
|
|
50
|
+
input: DeviceBatchRequest<DeviceReleaseStatusRequest>,
|
|
51
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceReleaseStatusResponse>>>;
|
|
52
|
+
|
|
53
|
+
/** POST `/devices/notify` — aviso en pantalla; título ≤ 30 y contenido ≤ 100 caracteres. */
|
|
54
|
+
notifyDevices(
|
|
55
|
+
input: DeviceBatchRequest<DeviceNotifyRequest>,
|
|
56
|
+
): Promise<StandardResponse<DeviceBatchResult<DeviceNotifyResponse>>>;
|
|
57
|
+
}
|