@flashbacktech/flashbackclient 0.1.69 → 0.1.71
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/client.d.ts +10 -0
- package/dist/api/client.js +29 -0
- package/dist/api/index.d.ts +2 -1
- package/dist/api/index.js +3 -1
- package/dist/api/types/device.d.ts +113 -0
- package/dist/api/types/device.js +2 -0
- package/dist/stellarv2/client/deal.d.ts +1 -0
- package/dist/stellarv2/client/deal.js +6 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutR
|
|
|
4
4
|
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams, BucketStatsResponse, StatsQueryWithBucketParams, NodeStatsQueryWithBucketParams, NodeStatsDailyQueryWithBucketParams } from './types/stats';
|
|
5
5
|
import { NodeInfo } from './types/bridge';
|
|
6
6
|
import { QuotaResponse } from './types/quota';
|
|
7
|
+
import { DeviceListResponse, DeviceDetailsResponse, SessionListResponse, TrustDeviceRequest, TrustDeviceResponse, UntrustDeviceResponse, RemoveDeviceResponse, RevokeSessionResponse, RevokeAllSessionsResponse, SessionHeartbeatResponse } from './types/device';
|
|
7
8
|
import { BuySubscriptionRequest, BuySubscriptionResponse, GetSubscriptionsResponse, MySubscriptionResponse, PaymentsListResponse, PaymentsQueryParams, CancelSubscriptionResponse } from './types/subscriptions';
|
|
8
9
|
interface ErrorResponse {
|
|
9
10
|
message?: string;
|
|
@@ -110,5 +111,14 @@ export declare class ApiClient implements IApiClient {
|
|
|
110
111
|
buySubscription: (data: BuySubscriptionRequest) => Promise<BuySubscriptionResponse>;
|
|
111
112
|
getPayments: (params?: PaymentsQueryParams) => Promise<PaymentsListResponse>;
|
|
112
113
|
cancelSubscription: () => Promise<CancelSubscriptionResponse>;
|
|
114
|
+
getDevices: () => Promise<DeviceListResponse>;
|
|
115
|
+
getDeviceDetails: (deviceId: string) => Promise<DeviceDetailsResponse>;
|
|
116
|
+
trustDevice: (data: TrustDeviceRequest) => Promise<TrustDeviceResponse>;
|
|
117
|
+
untrustDevice: (deviceId: string) => Promise<UntrustDeviceResponse>;
|
|
118
|
+
removeDevice: (deviceId: string) => Promise<RemoveDeviceResponse>;
|
|
119
|
+
getSessions: () => Promise<SessionListResponse>;
|
|
120
|
+
revokeSession: (sessionId: string) => Promise<RevokeSessionResponse>;
|
|
121
|
+
revokeAllSessions: () => Promise<RevokeAllSessionsResponse>;
|
|
122
|
+
updateSessionHeartbeat: (sessionId: string) => Promise<SessionHeartbeatResponse>;
|
|
113
123
|
}
|
|
114
124
|
export {};
|
package/dist/api/client.js
CHANGED
|
@@ -305,6 +305,35 @@ class ApiClient {
|
|
|
305
305
|
this.cancelSubscription = async () => {
|
|
306
306
|
return this.makeRequest('subscriptions/cancel', 'POST', null);
|
|
307
307
|
};
|
|
308
|
+
////// Device Management API
|
|
309
|
+
this.getDevices = async () => {
|
|
310
|
+
return this.makeRequest('devices', 'GET', null);
|
|
311
|
+
};
|
|
312
|
+
this.getDeviceDetails = async (deviceId) => {
|
|
313
|
+
return this.makeRequest(`devices/${deviceId}`, 'GET', null);
|
|
314
|
+
};
|
|
315
|
+
this.trustDevice = async (data) => {
|
|
316
|
+
return this.makeRequest('devices/trust', 'POST', data);
|
|
317
|
+
};
|
|
318
|
+
this.untrustDevice = async (deviceId) => {
|
|
319
|
+
return this.makeRequest(`devices/${deviceId}/untrust`, 'POST', null);
|
|
320
|
+
};
|
|
321
|
+
this.removeDevice = async (deviceId) => {
|
|
322
|
+
return this.makeRequest(`devices/${deviceId}`, 'DELETE', null);
|
|
323
|
+
};
|
|
324
|
+
////// Session Management API
|
|
325
|
+
this.getSessions = async () => {
|
|
326
|
+
return this.makeRequest('sessions', 'GET', null);
|
|
327
|
+
};
|
|
328
|
+
this.revokeSession = async (sessionId) => {
|
|
329
|
+
return this.makeRequest(`sessions/${sessionId}/revoke`, 'POST', null);
|
|
330
|
+
};
|
|
331
|
+
this.revokeAllSessions = async () => {
|
|
332
|
+
return this.makeRequest('sessions/revoke-all', 'POST', null);
|
|
333
|
+
};
|
|
334
|
+
this.updateSessionHeartbeat = async (sessionId) => {
|
|
335
|
+
return this.makeRequest(`sessions/${sessionId}/heartbeat`, 'POST', null);
|
|
336
|
+
};
|
|
308
337
|
this.baseURL = baseURL;
|
|
309
338
|
this.headers = {};
|
|
310
339
|
this.debug = false;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -7,4 +7,5 @@ import * as BridgeTypes from './types/bridge';
|
|
|
7
7
|
import * as EmailTypes from './types/email';
|
|
8
8
|
import * as QuotaTypes from './types/quota';
|
|
9
9
|
import * as SubscriptionTypes from './types/subscriptions';
|
|
10
|
-
|
|
10
|
+
import * as DeviceTypes from './types/device';
|
|
11
|
+
export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes, DeviceTypes };
|
package/dist/api/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
36
|
+
exports.DeviceTypes = exports.SubscriptionTypes = exports.QuotaTypes = exports.EmailTypes = exports.BridgeTypes = exports.HttpError = exports.ApiInterfaces = exports.StatsTypes = exports.AuthTypes = exports.ApiTypes = exports.ApiClient = void 0;
|
|
37
37
|
const client_1 = require("./client");
|
|
38
38
|
Object.defineProperty(exports, "ApiClient", { enumerable: true, get: function () { return client_1.ApiClient; } });
|
|
39
39
|
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return client_1.HttpError; } });
|
|
@@ -53,3 +53,5 @@ const QuotaTypes = __importStar(require("./types/quota"));
|
|
|
53
53
|
exports.QuotaTypes = QuotaTypes;
|
|
54
54
|
const SubscriptionTypes = __importStar(require("./types/subscriptions"));
|
|
55
55
|
exports.SubscriptionTypes = SubscriptionTypes;
|
|
56
|
+
const DeviceTypes = __importStar(require("./types/device"));
|
|
57
|
+
exports.DeviceTypes = DeviceTypes;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export interface DeviceListResponse {
|
|
2
|
+
success: boolean;
|
|
3
|
+
devices: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
deviceName: string;
|
|
6
|
+
deviceType: string;
|
|
7
|
+
os: string;
|
|
8
|
+
browser: string;
|
|
9
|
+
ipAddress?: string;
|
|
10
|
+
country?: string;
|
|
11
|
+
city?: string;
|
|
12
|
+
isTrusted: boolean;
|
|
13
|
+
trustLevel: string;
|
|
14
|
+
lastSeen: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
trustExpiresAt?: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export interface SessionListResponse {
|
|
20
|
+
success: boolean;
|
|
21
|
+
sessions: Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
deviceName: string;
|
|
24
|
+
ipAddress?: string;
|
|
25
|
+
location?: string;
|
|
26
|
+
startedAt: string;
|
|
27
|
+
lastActivity: string;
|
|
28
|
+
expiresAt: string;
|
|
29
|
+
loginMethod: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export interface DeviceDetailsResponse {
|
|
33
|
+
success: boolean;
|
|
34
|
+
device: {
|
|
35
|
+
id: string;
|
|
36
|
+
deviceName: string;
|
|
37
|
+
deviceType: string;
|
|
38
|
+
os: string;
|
|
39
|
+
browser: string;
|
|
40
|
+
ipAddress?: string;
|
|
41
|
+
country?: string;
|
|
42
|
+
city?: string;
|
|
43
|
+
isTrusted: boolean;
|
|
44
|
+
trustLevel: string;
|
|
45
|
+
lastSeen: string;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
trustExpiresAt?: string;
|
|
48
|
+
userAgent?: string;
|
|
49
|
+
deviceFingerprint?: string;
|
|
50
|
+
sessions: Array<{
|
|
51
|
+
id: string;
|
|
52
|
+
ipAddress?: string;
|
|
53
|
+
location?: string;
|
|
54
|
+
startedAt: string;
|
|
55
|
+
lastActivity: string;
|
|
56
|
+
expiresAt: string;
|
|
57
|
+
loginMethod: string;
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface TrustDeviceRequest {
|
|
62
|
+
fingerprint: string;
|
|
63
|
+
}
|
|
64
|
+
export interface TrustDeviceResponse {
|
|
65
|
+
success: boolean;
|
|
66
|
+
message: string;
|
|
67
|
+
trustExpiresAt: string;
|
|
68
|
+
}
|
|
69
|
+
export interface UntrustDeviceResponse {
|
|
70
|
+
success: boolean;
|
|
71
|
+
message: string;
|
|
72
|
+
}
|
|
73
|
+
export interface RemoveDeviceResponse {
|
|
74
|
+
success: boolean;
|
|
75
|
+
message: string;
|
|
76
|
+
}
|
|
77
|
+
export interface RevokeSessionResponse {
|
|
78
|
+
success: boolean;
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
export interface RevokeAllSessionsResponse {
|
|
82
|
+
success: boolean;
|
|
83
|
+
message: string;
|
|
84
|
+
}
|
|
85
|
+
export interface SessionHeartbeatResponse {
|
|
86
|
+
success: boolean;
|
|
87
|
+
message: string;
|
|
88
|
+
newExpiry: string;
|
|
89
|
+
}
|
|
90
|
+
export interface DeviceInfo {
|
|
91
|
+
userAgent: string;
|
|
92
|
+
ipAddress?: string;
|
|
93
|
+
deviceType: 'DESKTOP' | 'MOBILE' | 'TABLET';
|
|
94
|
+
os: string;
|
|
95
|
+
browser: string;
|
|
96
|
+
screenResolution?: string;
|
|
97
|
+
timezone?: string;
|
|
98
|
+
language?: string;
|
|
99
|
+
platform?: string;
|
|
100
|
+
hardwareConcurrency?: number;
|
|
101
|
+
deviceMemory?: number;
|
|
102
|
+
}
|
|
103
|
+
export interface GeolocationInfo {
|
|
104
|
+
country?: string;
|
|
105
|
+
city?: string;
|
|
106
|
+
region?: string;
|
|
107
|
+
timezone?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface DeviceFingerprint {
|
|
110
|
+
fingerprint: string;
|
|
111
|
+
deviceInfo: DeviceInfo;
|
|
112
|
+
geolocation: GeolocationInfo;
|
|
113
|
+
}
|
|
@@ -24,6 +24,7 @@ export declare class DealOps {
|
|
|
24
24
|
* @returns Promise resolving to the acceptance result
|
|
25
25
|
*/
|
|
26
26
|
setDealAccepted: (provider_id: string, consumer_id: string, deal_id: number) => Promise<void>;
|
|
27
|
+
setDealRejected: (provider_id: string, consumer_id: string, deal_id: number) => Promise<void>;
|
|
27
28
|
/**
|
|
28
29
|
* Sets a deal as funded by the consumer
|
|
29
30
|
* @param consumer_id - Address of the consumer funding the deal
|
|
@@ -50,6 +50,12 @@ class DealOps {
|
|
|
50
50
|
{ value: deal_id, type: 'u32' }
|
|
51
51
|
]);
|
|
52
52
|
});
|
|
53
|
+
this.setDealRejected = (0, decorator_1.withSignature)(async (provider_id, consumer_id, deal_id) => {
|
|
54
|
+
await (0, transaction_1.executeWalletTransaction)(this.context, provider_id, "set_deal_rejected", [
|
|
55
|
+
{ value: consumer_id, type: 'address' },
|
|
56
|
+
{ value: deal_id, type: 'u32' }
|
|
57
|
+
]);
|
|
58
|
+
});
|
|
53
59
|
/**
|
|
54
60
|
* Sets a deal as funded by the consumer
|
|
55
61
|
* @param consumer_id - Address of the consumer funding the deal
|