@fatehan/tsrp 1.1.14 → 1.2.1
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.d.ts +9 -8
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +66 -78
- package/dist/api.old.d.ts +19 -0
- package/dist/api.old.d.ts.map +1 -0
- package/dist/api.old.js +52 -0
- package/dist/api.test.js +38 -21
- package/dist/fatehan/identities/authentication.d.ts +67 -0
- package/dist/fatehan/identities/authentication.d.ts.map +1 -0
- package/dist/fatehan/identities/authentication.js +616 -0
- package/dist/fatehan/identities/identities.d.ts +2 -0
- package/dist/fatehan/identities/identities.d.ts.map +1 -1
- package/dist/fatehan/identities/identities.js +18 -1
- package/dist/fatehan/packets/dataModel.d.ts +2 -0
- package/dist/fatehan/packets/dataModel.d.ts.map +1 -1
- package/dist/fatehan/packets/dataModel.js +23 -1
- package/dist/report.d.ts +19 -18
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +120 -202
- package/dist/report.old.d.ts +39 -0
- package/dist/report.old.d.ts.map +1 -0
- package/dist/report.old.js +148 -0
- package/dist/report.test.js +103 -362
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
export type HeaderProvider = () => Promise<HeadersInit> | HeadersInit;
|
|
2
2
|
export declare class ApiService {
|
|
3
3
|
private readonly url;
|
|
4
4
|
private readonly namespace;
|
|
5
|
-
private readonly
|
|
6
|
-
constructor(url: string,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
private readonly getDynamicHeaders;
|
|
6
|
+
constructor(url: string, headerProvider: HeaderProvider);
|
|
7
|
+
private _call;
|
|
8
|
+
MeIndex(request: import("./fatehan/services/api").MeRequest): Promise<import("./fatehan/services/api").MeResponse>;
|
|
9
|
+
DeviceIndex(request: import("./fatehan/services/api").DeviceRequest): Promise<import("./fatehan/services/api").DeviceResponse>;
|
|
10
|
+
AreaIndex(request: import("./fatehan/services/api").AreaIndexRequest): Promise<import("./fatehan/services/api").AreaIndexResponse>;
|
|
11
|
+
ConfigIndex(request: import("./fatehan/services/api").ConfigRequest): Promise<import("./fatehan/services/api").ConfigResponse>;
|
|
12
|
+
UserIndex(request: import("./fatehan/services/api").UserRequest): Promise<import("./fatehan/services/api").UserResponse>;
|
|
12
13
|
}
|
|
13
14
|
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAEtE,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6C;IACvE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;gBAEvC,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IA+BN,OAAO,CAAC,OAAO,EAAE,OAAO,wBAAwB,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,wBAAwB,EAAE,UAAU,CAAC;IAKlH,WAAW,CAAC,OAAO,EAAE,OAAO,wBAAwB,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,wBAAwB,EAAE,cAAc,CAAC;IAK9H,SAAS,CAAC,OAAO,EAAE,OAAO,wBAAwB,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,wBAAwB,EAAE,iBAAiB,CAAC;IAKlI,WAAW,CAAC,OAAO,EAAE,OAAO,wBAAwB,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,wBAAwB,EAAE,cAAc,CAAC;IAK9H,SAAS,CAAC,OAAO,EAAE,OAAO,wBAAwB,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,wBAAwB,EAAE,YAAY,CAAC;CAIxI"}
|
package/dist/api.js
CHANGED
|
@@ -1,97 +1,85 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.ApiService = void 0;
|
|
4
|
-
const api_1 = require("./fatehan/services/api");
|
|
5
37
|
class ApiService {
|
|
6
|
-
constructor(url,
|
|
38
|
+
constructor(url, headerProvider) {
|
|
7
39
|
this.namespace = "com.fatehan.services.ApiService";
|
|
8
40
|
this.url = url;
|
|
9
|
-
this.
|
|
41
|
+
this.getDynamicHeaders = headerProvider;
|
|
42
|
+
}
|
|
43
|
+
async _call(methodName, request, encoder, decoder) {
|
|
44
|
+
const dynamicHeaders = await this.getDynamicHeaders();
|
|
45
|
+
const headers = {
|
|
10
46
|
"Content-Type": "application/octet-stream",
|
|
11
47
|
Accept: "application/octet-stream",
|
|
48
|
+
...dynamicHeaders,
|
|
12
49
|
};
|
|
13
|
-
|
|
14
|
-
|
|
50
|
+
const response = await fetch(`${this.url}/${this.namespace}/${methodName}`, {
|
|
51
|
+
method: "POST",
|
|
52
|
+
headers: headers,
|
|
53
|
+
body: new Uint8Array(encoder.encode(request).finish()),
|
|
54
|
+
});
|
|
55
|
+
if (response.ok) {
|
|
56
|
+
const buffer = await response.arrayBuffer();
|
|
57
|
+
return decoder.decode(new Uint8Array(buffer));
|
|
15
58
|
}
|
|
16
|
-
|
|
17
|
-
|
|
59
|
+
else {
|
|
60
|
+
const errorText = await response.text();
|
|
61
|
+
throw new Error(`API Error (${response.status}): ${errorText}`);
|
|
18
62
|
}
|
|
19
63
|
}
|
|
20
|
-
MeIndex(request) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const response = await fetch(`${this.url}/${this.namespace}/MeIndex`, {
|
|
24
|
-
method: "POST",
|
|
25
|
-
headers: this.headers,
|
|
26
|
-
body: req,
|
|
27
|
-
});
|
|
28
|
-
if (response.ok) {
|
|
29
|
-
resolve(api_1.MeResponse.decode(new Uint8Array(await response.arrayBuffer())));
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
reject(await response.text());
|
|
33
|
-
}
|
|
34
|
-
});
|
|
64
|
+
async MeIndex(request) {
|
|
65
|
+
const { MeRequest, MeResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
66
|
+
return this._call("MeIndex", request, MeRequest, MeResponse);
|
|
35
67
|
}
|
|
36
|
-
DeviceIndex(request) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
method: "POST",
|
|
40
|
-
headers: this.headers,
|
|
41
|
-
body: new Uint8Array(api_1.DeviceRequest.encode(request).finish()),
|
|
42
|
-
});
|
|
43
|
-
if (response.ok) {
|
|
44
|
-
resolve(api_1.DeviceResponse.decode(new Uint8Array(await response.arrayBuffer())));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
reject(await response.text());
|
|
48
|
-
}
|
|
49
|
-
});
|
|
68
|
+
async DeviceIndex(request) {
|
|
69
|
+
const { DeviceRequest, DeviceResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
70
|
+
return this._call("DeviceIndex", request, DeviceRequest, DeviceResponse);
|
|
50
71
|
}
|
|
51
|
-
AreaIndex(request) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
method: "POST",
|
|
55
|
-
headers: this.headers,
|
|
56
|
-
body: new Uint8Array(api_1.AreaIndexRequest.encode(request).finish()),
|
|
57
|
-
});
|
|
58
|
-
if (response.ok) {
|
|
59
|
-
resolve(api_1.AreaIndexResponse.decode(new Uint8Array(await response.arrayBuffer())));
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
reject(await response.text());
|
|
63
|
-
}
|
|
64
|
-
});
|
|
72
|
+
async AreaIndex(request) {
|
|
73
|
+
const { AreaIndexRequest, AreaIndexResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
74
|
+
return this._call("AreaIndex", request, AreaIndexRequest, AreaIndexResponse);
|
|
65
75
|
}
|
|
66
|
-
ConfigIndex(request) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
method: "POST",
|
|
70
|
-
headers: this.headers,
|
|
71
|
-
body: new Uint8Array(api_1.ConfigRequest.encode(request).finish()),
|
|
72
|
-
});
|
|
73
|
-
if (response.ok) {
|
|
74
|
-
resolve(api_1.ConfigResponse.decode(new Uint8Array(await response.arrayBuffer())));
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
reject(await response.text());
|
|
78
|
-
}
|
|
79
|
-
});
|
|
76
|
+
async ConfigIndex(request) {
|
|
77
|
+
const { ConfigRequest, ConfigResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
78
|
+
return this._call("ConfigIndex", request, ConfigRequest, ConfigResponse);
|
|
80
79
|
}
|
|
81
|
-
UserIndex(request) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
method: "POST",
|
|
85
|
-
headers: this.headers,
|
|
86
|
-
body: new Uint8Array(api_1.UserRequest.encode(request).finish()),
|
|
87
|
-
});
|
|
88
|
-
if (response.ok) {
|
|
89
|
-
resolve(api_1.UserResponse.decode(new Uint8Array(await response.arrayBuffer())));
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
reject(await response.text());
|
|
93
|
-
}
|
|
94
|
-
});
|
|
80
|
+
async UserIndex(request) {
|
|
81
|
+
const { UserRequest, UserResponse } = await Promise.resolve().then(() => __importStar(require("./fatehan/services/api")));
|
|
82
|
+
return this._call("UserIndex", request, UserRequest, UserResponse);
|
|
95
83
|
}
|
|
96
84
|
}
|
|
97
85
|
exports.ApiService = ApiService;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AreaIndexRequest, AreaIndexResponse, ConfigRequest, ConfigResponse, DeviceRequest, DeviceResponse, MeRequest, MeResponse, UserRequest, UserResponse } from "./fatehan/services/api";
|
|
2
|
+
export type HeaderProvider = () => Promise<HeadersInit> | HeadersInit;
|
|
3
|
+
export declare class ApiService {
|
|
4
|
+
private readonly url;
|
|
5
|
+
private readonly namespace;
|
|
6
|
+
private readonly getDynamicHeaders;
|
|
7
|
+
/**
|
|
8
|
+
* @param url The base URL of the API server.
|
|
9
|
+
* @param headerProvider A function that returns headers to be added to each request.
|
|
10
|
+
*/
|
|
11
|
+
constructor(url: string, headerProvider: HeaderProvider);
|
|
12
|
+
private _call;
|
|
13
|
+
MeIndex(request: MeRequest): Promise<MeResponse>;
|
|
14
|
+
DeviceIndex(request: DeviceRequest): Promise<DeviceResponse>;
|
|
15
|
+
AreaIndex(request: AreaIndexRequest): Promise<AreaIndexResponse>;
|
|
16
|
+
ConfigIndex(request: ConfigRequest): Promise<ConfigResponse>;
|
|
17
|
+
UserIndex(request: UserRequest): Promise<UserResponse>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=api.old.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.old.d.ts","sourceRoot":"","sources":["../src/api.old.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACb,cAAc,EACd,SAAS,EACT,UAAU,EACV,WAAW,EACX,YAAY,EACf,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,CAAC;AAEtE,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6C;IACvE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAEnD;;;OAGG;gBACS,GAAG,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc;YAKzC,KAAK;IA+BZ,OAAO,CAAC,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhD,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAI5D,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIhE,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAI5D,SAAS,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CAGhE"}
|
package/dist/api.old.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiService = void 0;
|
|
4
|
+
const api_1 = require("./fatehan/services/api");
|
|
5
|
+
class ApiService {
|
|
6
|
+
/**
|
|
7
|
+
* @param url The base URL of the API server.
|
|
8
|
+
* @param headerProvider A function that returns headers to be added to each request.
|
|
9
|
+
*/
|
|
10
|
+
constructor(url, headerProvider) {
|
|
11
|
+
this.namespace = "com.fatehan.services.ApiService";
|
|
12
|
+
this.url = url;
|
|
13
|
+
this.getDynamicHeaders = headerProvider;
|
|
14
|
+
}
|
|
15
|
+
async _call(methodName, request, encoder, decoder) {
|
|
16
|
+
const dynamicHeaders = await this.getDynamicHeaders();
|
|
17
|
+
const headers = {
|
|
18
|
+
"Content-Type": "application/octet-stream",
|
|
19
|
+
Accept: "application/octet-stream",
|
|
20
|
+
...dynamicHeaders,
|
|
21
|
+
};
|
|
22
|
+
const response = await fetch(`${this.url}/${this.namespace}/${methodName}`, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
headers: headers,
|
|
25
|
+
body: new Uint8Array(encoder.encode(request).finish()),
|
|
26
|
+
});
|
|
27
|
+
if (response.ok) {
|
|
28
|
+
const buffer = await response.arrayBuffer();
|
|
29
|
+
return decoder.decode(new Uint8Array(buffer));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const errorText = await response.text();
|
|
33
|
+
throw new Error(`API Error (${response.status}): ${errorText}`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
MeIndex(request) {
|
|
37
|
+
return this._call("MeIndex", request, api_1.MeRequest, api_1.MeResponse);
|
|
38
|
+
}
|
|
39
|
+
DeviceIndex(request) {
|
|
40
|
+
return this._call("DeviceIndex", request, api_1.DeviceRequest, api_1.DeviceResponse);
|
|
41
|
+
}
|
|
42
|
+
AreaIndex(request) {
|
|
43
|
+
return this._call("AreaIndex", request, api_1.AreaIndexRequest, api_1.AreaIndexResponse);
|
|
44
|
+
}
|
|
45
|
+
ConfigIndex(request) {
|
|
46
|
+
return this._call("ConfigIndex", request, api_1.ConfigRequest, api_1.ConfigResponse);
|
|
47
|
+
}
|
|
48
|
+
UserIndex(request) {
|
|
49
|
+
return this._call("UserIndex", request, api_1.UserRequest, api_1.UserResponse);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.ApiService = ApiService;
|
package/dist/api.test.js
CHANGED
|
@@ -1,33 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
const vitest_1 = require("vitest");
|
|
7
4
|
const api_1 = require("./api");
|
|
8
|
-
|
|
5
|
+
global.fetch = vitest_1.vi.fn();
|
|
9
6
|
(0, vitest_1.describe)("ApiService", () => {
|
|
10
|
-
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const url = "http://fake-api-server.com/gapi";
|
|
8
|
+
let service;
|
|
9
|
+
let mockHeaderProvider;
|
|
10
|
+
(0, vitest_1.beforeEach)(() => {
|
|
11
|
+
vitest_1.vi.clearAllMocks();
|
|
12
|
+
mockHeaderProvider = vitest_1.vi.fn(() => ({
|
|
13
|
+
'authorization': 'Bearer test-token-from-mock',
|
|
14
|
+
'organization-id': 'test-org-from-mock'
|
|
15
|
+
}));
|
|
16
|
+
service = new api_1.ApiService(url, mockHeaderProvider);
|
|
17
|
+
});
|
|
18
|
+
const setupMockSuccessResponse = (data = {}) => {
|
|
19
|
+
global.fetch.mockResolvedValue({
|
|
20
|
+
ok: true,
|
|
21
|
+
arrayBuffer: () => Promise.resolve(new Uint8Array()),
|
|
22
|
+
text: () => Promise.resolve("Success"),
|
|
20
23
|
});
|
|
21
|
-
|
|
24
|
+
};
|
|
25
|
+
(0, vitest_1.it)("should call MeIndex with correct headers and URL", async () => {
|
|
26
|
+
setupMockSuccessResponse();
|
|
27
|
+
await service.MeIndex({});
|
|
28
|
+
(0, vitest_1.expect)(mockHeaderProvider).toHaveBeenCalledOnce();
|
|
29
|
+
(0, vitest_1.expect)(global.fetch).toHaveBeenCalledWith(`${url}/com.fatehan.services.ApiService/MeIndex`, vitest_1.expect.objectContaining({
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: vitest_1.expect.objectContaining({
|
|
32
|
+
'authorization': 'Bearer test-token-from-mock'
|
|
33
|
+
})
|
|
34
|
+
}));
|
|
22
35
|
});
|
|
23
|
-
(0, vitest_1.it)("ConfigIndex", async () => {
|
|
24
|
-
|
|
36
|
+
(0, vitest_1.it)("should call ConfigIndex with correct headers and URL", async () => {
|
|
37
|
+
setupMockSuccessResponse();
|
|
38
|
+
await service.ConfigIndex({
|
|
25
39
|
domain: "api.myavl.ir",
|
|
26
40
|
});
|
|
27
|
-
|
|
41
|
+
(0, vitest_1.expect)(mockHeaderProvider).toHaveBeenCalledOnce();
|
|
42
|
+
(0, vitest_1.expect)(global.fetch).toHaveBeenCalledWith(`${url}/com.fatehan.services.ApiService/ConfigIndex`, vitest_1.expect.any(Object));
|
|
28
43
|
});
|
|
29
|
-
(0, vitest_1.it)("DeviceIndex", async () => {
|
|
30
|
-
|
|
44
|
+
(0, vitest_1.it)("should call DeviceIndex with correct headers and URL", async () => {
|
|
45
|
+
setupMockSuccessResponse();
|
|
46
|
+
await service.DeviceIndex({
|
|
31
47
|
includeDeviceStatus: false,
|
|
32
48
|
organizationId: undefined,
|
|
33
49
|
queryFilter: {},
|
|
@@ -39,6 +55,7 @@ const long_1 = __importDefault(require("long"));
|
|
|
39
55
|
page: 1,
|
|
40
56
|
pageSize: 15,
|
|
41
57
|
});
|
|
42
|
-
|
|
58
|
+
(0, vitest_1.expect)(mockHeaderProvider).toHaveBeenCalledOnce();
|
|
59
|
+
(0, vitest_1.expect)(global.fetch).toHaveBeenCalledWith(`${url}/com.fatehan.services.ApiService/DeviceIndex`, vitest_1.expect.any(Object));
|
|
43
60
|
});
|
|
44
61
|
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import Long from "long";
|
|
3
|
+
import { User } from "./identities";
|
|
4
|
+
export declare const protobufPackage = "com.fatehan.identities";
|
|
5
|
+
export interface OtpCodeRequest {
|
|
6
|
+
phone: Long;
|
|
7
|
+
}
|
|
8
|
+
export interface OtpCodeResponse {
|
|
9
|
+
message: string;
|
|
10
|
+
passwordRequired: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface AuthResponse {
|
|
13
|
+
user?: User | undefined;
|
|
14
|
+
token: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AuthRequest {
|
|
17
|
+
passwordAuth?: PasswordAuth | undefined;
|
|
18
|
+
googleAuth?: GoogleAuth | undefined;
|
|
19
|
+
qrCodeAuth?: QrCodeAuth | undefined;
|
|
20
|
+
telegramAuth?: TelegramAuth | undefined;
|
|
21
|
+
otpAuth?: OtpAuth | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface PasswordAuth {
|
|
24
|
+
phone: Long;
|
|
25
|
+
password: string;
|
|
26
|
+
}
|
|
27
|
+
export interface QrCodeAuth {
|
|
28
|
+
token: string;
|
|
29
|
+
}
|
|
30
|
+
export interface OtpAuth {
|
|
31
|
+
phone: Long;
|
|
32
|
+
code: number;
|
|
33
|
+
password?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface GoogleAuth {
|
|
36
|
+
}
|
|
37
|
+
export interface TelegramAuth {
|
|
38
|
+
}
|
|
39
|
+
export declare const OtpCodeRequest: MessageFns<OtpCodeRequest>;
|
|
40
|
+
export declare const OtpCodeResponse: MessageFns<OtpCodeResponse>;
|
|
41
|
+
export declare const AuthResponse: MessageFns<AuthResponse>;
|
|
42
|
+
export declare const AuthRequest: MessageFns<AuthRequest>;
|
|
43
|
+
export declare const PasswordAuth: MessageFns<PasswordAuth>;
|
|
44
|
+
export declare const QrCodeAuth: MessageFns<QrCodeAuth>;
|
|
45
|
+
export declare const OtpAuth: MessageFns<OtpAuth>;
|
|
46
|
+
export declare const GoogleAuth: MessageFns<GoogleAuth>;
|
|
47
|
+
export declare const TelegramAuth: MessageFns<TelegramAuth>;
|
|
48
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
49
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
50
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
51
|
+
} : Partial<T>;
|
|
52
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
53
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
54
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
55
|
+
} & {
|
|
56
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
57
|
+
};
|
|
58
|
+
export interface MessageFns<T> {
|
|
59
|
+
encode(message: T, writer?: BinaryWriter): BinaryWriter;
|
|
60
|
+
decode(input: BinaryReader | Uint8Array, length?: number): T;
|
|
61
|
+
fromJSON(object: any): T;
|
|
62
|
+
toJSON(message: T): unknown;
|
|
63
|
+
create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
|
|
64
|
+
fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
67
|
+
//# sourceMappingURL=authentication.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../src/fatehan/identities/authentication.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,eAAO,MAAM,eAAe,2BAA2B,CAAC;AAExD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,UAAU,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IACpC,YAAY,CAAC,EAAE,YAAY,GAAG,SAAS,CAAC;IACxC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,IAAI,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;CAC1B;AAED,MAAM,WAA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