@flashbacktech/flashbackclient 0.1.70 → 0.1.72

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.
@@ -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 {};
@@ -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;
@@ -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
- export { ApiClient, ApiTypes, AuthTypes, StatsTypes, ApiInterfaces, HttpError, BridgeTypes, EmailTypes, QuotaTypes, SubscriptionTypes };
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,131 @@
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
+ }
114
+ export declare enum TrustEventType {
115
+ LOGIN_ATTEMPT = 0,
116
+ FAILED_LOGIN_ATTEMPT = 1,
117
+ SUCCESSFUL_LOGIN = 2,
118
+ FAILED_LOGIN = 3,
119
+ PASSWORD_RESET_ATTEMPT = 4,
120
+ SUCCESSFUL_PASSWORD_RESET = 5,
121
+ FAILED_PASSWORD_RESET = 6,
122
+ TWO_FACTOR_ATTEMPT = 7,
123
+ SUCCESSFUL_TWO_FACTOR = 8,
124
+ FAILED_TWO_FACTOR = 9,
125
+ DEVICE_UNTRUSTED = 10,
126
+ DEVICE_TRUSTED = 11,
127
+ DEVICE_REMOVED = 12,
128
+ USER_UNTRUSTED = 13,
129
+ USER_TRUSTED = 14,
130
+ USER_REMOVED = 15
131
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TrustEventType = void 0;
4
+ var TrustEventType;
5
+ (function (TrustEventType) {
6
+ TrustEventType[TrustEventType["LOGIN_ATTEMPT"] = 0] = "LOGIN_ATTEMPT";
7
+ TrustEventType[TrustEventType["FAILED_LOGIN_ATTEMPT"] = 1] = "FAILED_LOGIN_ATTEMPT";
8
+ TrustEventType[TrustEventType["SUCCESSFUL_LOGIN"] = 2] = "SUCCESSFUL_LOGIN";
9
+ TrustEventType[TrustEventType["FAILED_LOGIN"] = 3] = "FAILED_LOGIN";
10
+ TrustEventType[TrustEventType["PASSWORD_RESET_ATTEMPT"] = 4] = "PASSWORD_RESET_ATTEMPT";
11
+ TrustEventType[TrustEventType["SUCCESSFUL_PASSWORD_RESET"] = 5] = "SUCCESSFUL_PASSWORD_RESET";
12
+ TrustEventType[TrustEventType["FAILED_PASSWORD_RESET"] = 6] = "FAILED_PASSWORD_RESET";
13
+ TrustEventType[TrustEventType["TWO_FACTOR_ATTEMPT"] = 7] = "TWO_FACTOR_ATTEMPT";
14
+ TrustEventType[TrustEventType["SUCCESSFUL_TWO_FACTOR"] = 8] = "SUCCESSFUL_TWO_FACTOR";
15
+ TrustEventType[TrustEventType["FAILED_TWO_FACTOR"] = 9] = "FAILED_TWO_FACTOR";
16
+ TrustEventType[TrustEventType["DEVICE_UNTRUSTED"] = 10] = "DEVICE_UNTRUSTED";
17
+ TrustEventType[TrustEventType["DEVICE_TRUSTED"] = 11] = "DEVICE_TRUSTED";
18
+ TrustEventType[TrustEventType["DEVICE_REMOVED"] = 12] = "DEVICE_REMOVED";
19
+ TrustEventType[TrustEventType["USER_UNTRUSTED"] = 13] = "USER_UNTRUSTED";
20
+ TrustEventType[TrustEventType["USER_TRUSTED"] = 14] = "USER_TRUSTED";
21
+ TrustEventType[TrustEventType["USER_REMOVED"] = 15] = "USER_REMOVED";
22
+ })(TrustEventType || (exports.TrustEventType = TrustEventType = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flashbacktech/flashbackclient",
3
- "version": "0.1.70",
3
+ "version": "0.1.72",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"