@oxyhq/services 5.13.15 → 5.13.16
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/README.md +10 -0
- package/lib/commonjs/core/OxyServices.base.js +271 -0
- package/lib/commonjs/core/OxyServices.base.js.map +1 -0
- package/lib/commonjs/core/OxyServices.errors.js +26 -0
- package/lib/commonjs/core/OxyServices.errors.js.map +1 -0
- package/lib/commonjs/core/OxyServices.js +58 -2168
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.analytics.js +60 -0
- package/lib/commonjs/core/mixins/OxyServices.analytics.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.assets.js +406 -0
- package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.auth.js +303 -0
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.developer.js +115 -0
- package/lib/commonjs/core/mixins/OxyServices.developer.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.devices.js +119 -0
- package/lib/commonjs/core/mixins/OxyServices.devices.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.karma.js +117 -0
- package/lib/commonjs/core/mixins/OxyServices.karma.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.language.js +124 -0
- package/lib/commonjs/core/mixins/OxyServices.language.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.location.js +55 -0
- package/lib/commonjs/core/mixins/OxyServices.location.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.payment.js +66 -0
- package/lib/commonjs/core/mixins/OxyServices.payment.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.privacy.js +174 -0
- package/lib/commonjs/core/mixins/OxyServices.privacy.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.totp.js +53 -0
- package/lib/commonjs/core/mixins/OxyServices.totp.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js +389 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.utility.js +161 -0
- package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -0
- package/lib/commonjs/core/mixins/index.js +39 -0
- package/lib/commonjs/core/mixins/index.js.map +1 -0
- package/lib/commonjs/core/mixins/mixinHelpers.js +62 -0
- package/lib/commonjs/core/mixins/mixinHelpers.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +27 -2
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/module/core/OxyServices.base.js +265 -0
- package/lib/module/core/OxyServices.base.js.map +1 -0
- package/lib/module/core/OxyServices.errors.js +20 -0
- package/lib/module/core/OxyServices.errors.js.map +1 -0
- package/lib/module/core/OxyServices.js +43 -2164
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.analytics.js +56 -0
- package/lib/module/core/mixins/OxyServices.analytics.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.assets.js +402 -0
- package/lib/module/core/mixins/OxyServices.assets.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.auth.js +299 -0
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.developer.js +111 -0
- package/lib/module/core/mixins/OxyServices.developer.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.devices.js +115 -0
- package/lib/module/core/mixins/OxyServices.devices.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.karma.js +113 -0
- package/lib/module/core/mixins/OxyServices.karma.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.language.js +120 -0
- package/lib/module/core/mixins/OxyServices.language.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.location.js +51 -0
- package/lib/module/core/mixins/OxyServices.location.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.payment.js +62 -0
- package/lib/module/core/mixins/OxyServices.payment.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.privacy.js +170 -0
- package/lib/module/core/mixins/OxyServices.privacy.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.totp.js +49 -0
- package/lib/module/core/mixins/OxyServices.totp.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.user.js +385 -0
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.utility.js +156 -0
- package/lib/module/core/mixins/OxyServices.utility.js.map +1 -0
- package/lib/module/core/mixins/index.js +36 -0
- package/lib/module/core/mixins/index.js.map +1 -0
- package/lib/module/core/mixins/mixinHelpers.js +56 -0
- package/lib/module/core/mixins/mixinHelpers.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +27 -2
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/typescript/core/OxyServices.base.d.ts +123 -0
- package/lib/typescript/core/OxyServices.base.d.ts.map +1 -0
- package/lib/typescript/core/OxyServices.d.ts +969 -746
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.errors.d.ts +12 -0
- package/lib/typescript/core/OxyServices.errors.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts +70 -0
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts +159 -0
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +168 -0
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts +103 -0
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts +93 -0
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts +89 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.language.d.ts +85 -0
- package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.location.d.ts +68 -0
- package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts +74 -0
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts +126 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts +69 -0
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +189 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts +97 -0
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -0
- package/lib/typescript/core/mixins/index.d.ts +898 -0
- package/lib/typescript/core/mixins/index.d.ts.map +1 -0
- package/lib/typescript/core/mixins/mixinHelpers.d.ts +32 -0
- package/lib/typescript/core/mixins/mixinHelpers.d.ts.map +1 -0
- package/lib/typescript/models/interfaces.d.ts +10 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +2 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/OxyServices.base.ts +311 -0
- package/src/core/OxyServices.errors.ts +26 -0
- package/src/core/OxyServices.ts +43 -2199
- package/src/core/mixins/OxyServices.analytics.ts +53 -0
- package/src/core/mixins/OxyServices.assets.ts +390 -0
- package/src/core/mixins/OxyServices.auth.ts +275 -0
- package/src/core/mixins/OxyServices.developer.ts +114 -0
- package/src/core/mixins/OxyServices.devices.ts +103 -0
- package/src/core/mixins/OxyServices.karma.ts +111 -0
- package/src/core/mixins/OxyServices.language.ts +127 -0
- package/src/core/mixins/OxyServices.location.ts +46 -0
- package/src/core/mixins/OxyServices.payment.ts +59 -0
- package/src/core/mixins/OxyServices.privacy.ts +182 -0
- package/src/core/mixins/OxyServices.totp.ts +36 -0
- package/src/core/mixins/OxyServices.user.ts +380 -0
- package/src/core/mixins/OxyServices.utility.ts +187 -0
- package/src/core/mixins/index.ts +58 -0
- package/src/core/mixins/mixinHelpers.ts +69 -0
- package/src/models/interfaces.ts +12 -0
- package/src/ui/context/OxyContext.tsx +36 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Management Methods Mixin
|
|
3
|
+
*/
|
|
4
|
+
import type { User, Notification, SearchProfilesResponse } from '../../models/interfaces';
|
|
5
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
6
|
+
import { type PaginationParams } from '../../utils/apiUtils';
|
|
7
|
+
export declare function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
/**
|
|
10
|
+
* Get profile by username
|
|
11
|
+
*/
|
|
12
|
+
getProfileByUsername(username: string): Promise<User>;
|
|
13
|
+
/**
|
|
14
|
+
* Search user profiles
|
|
15
|
+
*/
|
|
16
|
+
searchProfiles(query: string, pagination?: PaginationParams): Promise<SearchProfilesResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Get profile recommendations
|
|
19
|
+
*/
|
|
20
|
+
getProfileRecommendations(): Promise<Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
name?: {
|
|
24
|
+
first?: string;
|
|
25
|
+
last?: string;
|
|
26
|
+
full?: string;
|
|
27
|
+
};
|
|
28
|
+
description?: string;
|
|
29
|
+
_count?: {
|
|
30
|
+
followers: number;
|
|
31
|
+
following: number;
|
|
32
|
+
};
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}>>;
|
|
35
|
+
/**
|
|
36
|
+
* Get user by ID
|
|
37
|
+
*/
|
|
38
|
+
getUserById(userId: string): Promise<User>;
|
|
39
|
+
/**
|
|
40
|
+
* Get current user
|
|
41
|
+
*/
|
|
42
|
+
getCurrentUser(): Promise<User>;
|
|
43
|
+
/**
|
|
44
|
+
* Update user profile
|
|
45
|
+
*/
|
|
46
|
+
updateProfile(updates: Record<string, any>): Promise<User>;
|
|
47
|
+
/**
|
|
48
|
+
* Get privacy settings for a user
|
|
49
|
+
* @param userId - The user ID (defaults to current user)
|
|
50
|
+
*/
|
|
51
|
+
getPrivacySettings(userId?: string): Promise<any>;
|
|
52
|
+
/**
|
|
53
|
+
* Update privacy settings
|
|
54
|
+
* @param settings - Partial privacy settings object
|
|
55
|
+
* @param userId - The user ID (defaults to current user)
|
|
56
|
+
*/
|
|
57
|
+
updatePrivacySettings(settings: Record<string, any>, userId?: string): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Request account verification
|
|
60
|
+
*/
|
|
61
|
+
requestAccountVerification(reason: string, evidence?: string): Promise<{
|
|
62
|
+
message: string;
|
|
63
|
+
requestId: string;
|
|
64
|
+
}>;
|
|
65
|
+
/**
|
|
66
|
+
* Download account data export
|
|
67
|
+
*/
|
|
68
|
+
downloadAccountData(format?: "json" | "csv"): Promise<Blob>;
|
|
69
|
+
/**
|
|
70
|
+
* Delete account permanently
|
|
71
|
+
* @param password - User password for confirmation
|
|
72
|
+
* @param confirmText - Confirmation text (usually username)
|
|
73
|
+
*/
|
|
74
|
+
deleteAccount(password: string, confirmText: string): Promise<{
|
|
75
|
+
message: string;
|
|
76
|
+
}>;
|
|
77
|
+
/**
|
|
78
|
+
* Update user by ID (admin function)
|
|
79
|
+
*/
|
|
80
|
+
updateUser(userId: string, updates: Record<string, any>): Promise<User>;
|
|
81
|
+
/**
|
|
82
|
+
* Follow a user
|
|
83
|
+
*/
|
|
84
|
+
followUser(userId: string): Promise<{
|
|
85
|
+
success: boolean;
|
|
86
|
+
message: string;
|
|
87
|
+
}>;
|
|
88
|
+
/**
|
|
89
|
+
* Unfollow a user
|
|
90
|
+
*/
|
|
91
|
+
unfollowUser(userId: string): Promise<{
|
|
92
|
+
success: boolean;
|
|
93
|
+
message: string;
|
|
94
|
+
}>;
|
|
95
|
+
/**
|
|
96
|
+
* Get follow status
|
|
97
|
+
*/
|
|
98
|
+
getFollowStatus(userId: string): Promise<{
|
|
99
|
+
isFollowing: boolean;
|
|
100
|
+
}>;
|
|
101
|
+
/**
|
|
102
|
+
* Get user followers
|
|
103
|
+
*/
|
|
104
|
+
getUserFollowers(userId: string, pagination?: PaginationParams): Promise<{
|
|
105
|
+
followers: User[];
|
|
106
|
+
total: number;
|
|
107
|
+
hasMore: boolean;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* Get user following
|
|
111
|
+
*/
|
|
112
|
+
getUserFollowing(userId: string, pagination?: PaginationParams): Promise<{
|
|
113
|
+
following: User[];
|
|
114
|
+
total: number;
|
|
115
|
+
hasMore: boolean;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Get notifications
|
|
119
|
+
*/
|
|
120
|
+
getNotifications(): Promise<Notification[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Get unread notification count
|
|
123
|
+
*/
|
|
124
|
+
getUnreadCount(): Promise<number>;
|
|
125
|
+
/**
|
|
126
|
+
* Create notification
|
|
127
|
+
*/
|
|
128
|
+
createNotification(data: Partial<Notification>): Promise<Notification>;
|
|
129
|
+
/**
|
|
130
|
+
* Mark notification as read
|
|
131
|
+
*/
|
|
132
|
+
markNotificationAsRead(notificationId: string): Promise<void>;
|
|
133
|
+
/**
|
|
134
|
+
* Mark all notifications as read
|
|
135
|
+
*/
|
|
136
|
+
markAllNotificationsAsRead(): Promise<void>;
|
|
137
|
+
/**
|
|
138
|
+
* Delete notification
|
|
139
|
+
*/
|
|
140
|
+
deleteNotification(notificationId: string): Promise<void>;
|
|
141
|
+
httpClient: import("../HttpClient").HttpClient;
|
|
142
|
+
requestManager: import("../RequestManager").RequestManager;
|
|
143
|
+
cloudURL: string;
|
|
144
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
145
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../RequestManager").RequestOptions): Promise<T_1>;
|
|
146
|
+
getBaseURL(): string;
|
|
147
|
+
getClient(): import("../HttpClient").HttpClient;
|
|
148
|
+
getMetrics(): {
|
|
149
|
+
totalRequests: number;
|
|
150
|
+
successfulRequests: number;
|
|
151
|
+
failedRequests: number;
|
|
152
|
+
cacheHits: number;
|
|
153
|
+
cacheMisses: number;
|
|
154
|
+
averageResponseTime: number;
|
|
155
|
+
};
|
|
156
|
+
clearCache(): void;
|
|
157
|
+
clearCacheEntry(key: string): void;
|
|
158
|
+
getCacheStats(): {
|
|
159
|
+
size: number;
|
|
160
|
+
hits: number;
|
|
161
|
+
misses: number;
|
|
162
|
+
hitRate: number;
|
|
163
|
+
};
|
|
164
|
+
getCloudURL(): string;
|
|
165
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
166
|
+
clearTokens(): void;
|
|
167
|
+
getCurrentUserId(): string | null;
|
|
168
|
+
hasValidToken(): boolean;
|
|
169
|
+
getAccessToken(): string | null;
|
|
170
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
171
|
+
waitForAuthentication(timeoutMs?: number): Promise<boolean>;
|
|
172
|
+
hasAccessToken(): boolean;
|
|
173
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
174
|
+
maxRetries?: number;
|
|
175
|
+
retryDelay?: number;
|
|
176
|
+
authTimeoutMs?: number;
|
|
177
|
+
}): Promise<T_1>;
|
|
178
|
+
validate(): Promise<boolean>;
|
|
179
|
+
handleError(error: any): Error;
|
|
180
|
+
healthCheck(): Promise<{
|
|
181
|
+
status: string;
|
|
182
|
+
users?: number;
|
|
183
|
+
timestamp?: string;
|
|
184
|
+
[key: string]: any;
|
|
185
|
+
}>;
|
|
186
|
+
};
|
|
187
|
+
__resetTokensForTests(): void;
|
|
188
|
+
} & T;
|
|
189
|
+
//# sourceMappingURL=OxyServices.user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OxyServices.user.d.ts","sourceRoot":"","sources":["../../../../src/core/mixins/OxyServices.user.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import type { ApiError } from '../../models/interfaces';
|
|
2
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
3
|
+
export declare function OxyServicesUtilityMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch link metadata
|
|
7
|
+
*/
|
|
8
|
+
fetchLinkMetadata(url: string): Promise<{
|
|
9
|
+
url: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Simple Express.js authentication middleware
|
|
16
|
+
*
|
|
17
|
+
* Built-in authentication middleware that validates JWT tokens and adds user data to requests.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Basic usage - just add it to your routes
|
|
22
|
+
* app.use('/api/protected', oxyServices.auth());
|
|
23
|
+
*
|
|
24
|
+
* // With debug logging
|
|
25
|
+
* app.use('/api/protected', oxyServices.auth({ debug: true }));
|
|
26
|
+
*
|
|
27
|
+
* // With custom error handling
|
|
28
|
+
* app.use('/api/protected', oxyServices.auth({
|
|
29
|
+
* onError: (error) => console.error('Auth failed:', error)
|
|
30
|
+
* }));
|
|
31
|
+
*
|
|
32
|
+
* // Load full user data
|
|
33
|
+
* app.use('/api/protected', oxyServices.auth({ loadUser: true }));
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param options Optional configuration
|
|
37
|
+
* @param options.debug Enable debug logging (default: false)
|
|
38
|
+
* @param options.onError Custom error handler
|
|
39
|
+
* @param options.loadUser Load full user data (default: false for performance)
|
|
40
|
+
* @param options.session Use session-based validation (default: false)
|
|
41
|
+
* @returns Express middleware function
|
|
42
|
+
*/
|
|
43
|
+
auth(options?: {
|
|
44
|
+
debug?: boolean;
|
|
45
|
+
onError?: (error: ApiError) => any;
|
|
46
|
+
loadUser?: boolean;
|
|
47
|
+
session?: boolean;
|
|
48
|
+
}): (req: any, res: any, next: any) => any;
|
|
49
|
+
httpClient: import("../HttpClient").HttpClient;
|
|
50
|
+
requestManager: import("../RequestManager").RequestManager;
|
|
51
|
+
cloudURL: string;
|
|
52
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
53
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../RequestManager").RequestOptions): Promise<T_1>;
|
|
54
|
+
getBaseURL(): string;
|
|
55
|
+
getClient(): import("../HttpClient").HttpClient;
|
|
56
|
+
getMetrics(): {
|
|
57
|
+
totalRequests: number;
|
|
58
|
+
successfulRequests: number;
|
|
59
|
+
failedRequests: number;
|
|
60
|
+
cacheHits: number;
|
|
61
|
+
cacheMisses: number;
|
|
62
|
+
averageResponseTime: number;
|
|
63
|
+
};
|
|
64
|
+
clearCache(): void;
|
|
65
|
+
clearCacheEntry(key: string): void;
|
|
66
|
+
getCacheStats(): {
|
|
67
|
+
size: number;
|
|
68
|
+
hits: number;
|
|
69
|
+
misses: number;
|
|
70
|
+
hitRate: number;
|
|
71
|
+
};
|
|
72
|
+
getCloudURL(): string;
|
|
73
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
74
|
+
clearTokens(): void;
|
|
75
|
+
getCurrentUserId(): string | null;
|
|
76
|
+
hasValidToken(): boolean;
|
|
77
|
+
getAccessToken(): string | null;
|
|
78
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
79
|
+
waitForAuthentication(timeoutMs?: number): Promise<boolean>;
|
|
80
|
+
hasAccessToken(): boolean;
|
|
81
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
82
|
+
maxRetries?: number;
|
|
83
|
+
retryDelay?: number;
|
|
84
|
+
authTimeoutMs?: number;
|
|
85
|
+
}): Promise<T_1>;
|
|
86
|
+
validate(): Promise<boolean>;
|
|
87
|
+
handleError(error: any): Error;
|
|
88
|
+
healthCheck(): Promise<{
|
|
89
|
+
status: string;
|
|
90
|
+
users?: number;
|
|
91
|
+
timestamp?: string;
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
__resetTokensForTests(): void;
|
|
96
|
+
} & T;
|
|
97
|
+
//# sourceMappingURL=OxyServices.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OxyServices.utility.d.ts","sourceRoot":"","sources":["../../../../src/core/mixins/OxyServices.utility.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAW3D,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,OAAO,eAAe,EAAE,IAAI,EAAE,CAAC;kBAExD,GAAG,EAAE;QAG1B;;WAEG;+BAC0B,MAAM,GAAG,OAAO,CAAC;YAC5C,GAAG,EAAE,MAAM,CAAC;YACZ,KAAK,EAAE,MAAM,CAAC;YACd,WAAW,EAAE,MAAM,CAAC;YACpB,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAgBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA4BG;uBACW;YACZ,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC;YACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,OAAO,CAAC,EAAE,OAAO,CAAC;SACnB,IAIS,KAAK,GAAG,EAAE,KAAK,GAAG,EAAE,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAkFpB,CAAC;sBAA0B,CAAC;yBACzC,CAAV;;;;;;iBAkBi3E,CAAC;qBAAwB,CAAC;;;;;MAF14E"}
|