@fatehan/tsrp 1.3.7 → 1.3.9
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/api.js +2 -2
- package/dist/auth.d.ts +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +2 -2
- package/dist/tests/api.test.js +6 -4
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -93,7 +93,7 @@ class ApiService {
|
|
|
93
93
|
async IoIndex(request) {
|
|
94
94
|
if (request.deviceId != null) {
|
|
95
95
|
const cachedIo = (0, system_io_1.getDeviceIoCache)(request.deviceId.toString());
|
|
96
|
-
if (cachedIo != null) {
|
|
96
|
+
if (cachedIo != null && cachedIo != undefined) {
|
|
97
97
|
return { cost: 0, ios: cachedIo, records: cachedIo.length };
|
|
98
98
|
}
|
|
99
99
|
const { IoRequest, IoResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
@@ -103,7 +103,7 @@ class ApiService {
|
|
|
103
103
|
}
|
|
104
104
|
else {
|
|
105
105
|
const cachedIo = (0, system_io_1.getSystemIoCache)();
|
|
106
|
-
if (cachedIo != null) {
|
|
106
|
+
if (cachedIo != null && cachedIo != undefined) {
|
|
107
107
|
return { cost: 0, ios: cachedIo, records: cachedIo.length };
|
|
108
108
|
}
|
|
109
109
|
const { IoRequest, IoResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
package/dist/auth.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare class AuthService {
|
|
|
5
5
|
private readonly getDynamicHeaders;
|
|
6
6
|
constructor(url: string, headerProvider: HeaderProvider);
|
|
7
7
|
private _call;
|
|
8
|
-
|
|
8
|
+
Authenticate(request: import("./fatehan/identities/authentication").AuthRequest): Promise<import("./fatehan/identities/authentication").AuthResponse>;
|
|
9
9
|
OtpCode(request: import("./fatehan/identities/authentication").OtpCodeRequest): Promise<import("./fatehan/identities/authentication").OtpCodeResponse>;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnC,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgD;IAC1E,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IAgCN,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,GAAG,CAAC;AAEnC,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgD;IAC1E,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IAgCN,YAAY,CACvB,OAAO,EAAE,OAAO,qCAAqC,EAAE,WAAW,GACjE,OAAO,CAAC,OAAO,qCAAqC,EAAE,YAAY,CAAC;IAOzD,OAAO,CAClB,OAAO,EAAE,OAAO,qCAAqC,EAAE,cAAc,GACpE,OAAO,CAAC,OAAO,qCAAqC,EAAE,eAAe,CAAC;CAM1E"}
|
package/dist/auth.js
CHANGED
|
@@ -61,9 +61,9 @@ class AuthService {
|
|
|
61
61
|
throw new Error(`API Error (${response.status}): ${errorText}`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
async
|
|
64
|
+
async Authenticate(request) {
|
|
65
65
|
const { AuthRequest, AuthResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/identities/authentication")));
|
|
66
|
-
return this._call("
|
|
66
|
+
return this._call("Authenticate", request, AuthRequest, AuthResponse);
|
|
67
67
|
}
|
|
68
68
|
async OtpCode(request) {
|
|
69
69
|
const { OtpCodeRequest, OtpCodeResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/identities/authentication")));
|
package/dist/tests/api.test.js
CHANGED
|
@@ -10,8 +10,8 @@ global.fetch = vitest_1.vi.fn();
|
|
|
10
10
|
(0, vitest_1.beforeEach)(() => {
|
|
11
11
|
vitest_1.vi.clearAllMocks();
|
|
12
12
|
mockHeaderProvider = vitest_1.vi.fn(() => ({
|
|
13
|
-
authorization: "Bearer
|
|
14
|
-
"organization-id": "
|
|
13
|
+
authorization: "Bearer 258|1Pf5nFVZLvYfQD6BAXVi0PYuYR75ZfP05R8C1PXl314ba8dd",
|
|
14
|
+
"organization-id": "1000001",
|
|
15
15
|
}));
|
|
16
16
|
service = new api_1.ApiService(url, mockHeaderProvider);
|
|
17
17
|
});
|
|
@@ -52,7 +52,9 @@ global.fetch = vitest_1.vi.fn();
|
|
|
52
52
|
(0, vitest_1.expect)(global.fetch).toHaveBeenCalledWith(`${url}/com.fatehan.services.ApiService/DeviceIndex`, vitest_1.expect.any(Object));
|
|
53
53
|
});
|
|
54
54
|
(0, vitest_1.it)("should call IoIndex with correct headers and URL", async () => {
|
|
55
|
-
var x =
|
|
56
|
-
|
|
55
|
+
var x = service.IoIndex({}).then((x) => {
|
|
56
|
+
;
|
|
57
|
+
console.log(x);
|
|
58
|
+
});
|
|
57
59
|
});
|
|
58
60
|
});
|