@oxyhq/services 5.13.12 → 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.
Files changed (209) hide show
  1. package/README.md +10 -0
  2. package/lib/commonjs/core/OxyServices.base.js +271 -0
  3. package/lib/commonjs/core/OxyServices.base.js.map +1 -0
  4. package/lib/commonjs/core/OxyServices.errors.js +26 -0
  5. package/lib/commonjs/core/OxyServices.errors.js.map +1 -0
  6. package/lib/commonjs/core/OxyServices.js +58 -2009
  7. package/lib/commonjs/core/OxyServices.js.map +1 -1
  8. package/lib/commonjs/core/mixins/OxyServices.analytics.js +60 -0
  9. package/lib/commonjs/core/mixins/OxyServices.analytics.js.map +1 -0
  10. package/lib/commonjs/core/mixins/OxyServices.assets.js +406 -0
  11. package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -0
  12. package/lib/commonjs/core/mixins/OxyServices.auth.js +303 -0
  13. package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -0
  14. package/lib/commonjs/core/mixins/OxyServices.developer.js +115 -0
  15. package/lib/commonjs/core/mixins/OxyServices.developer.js.map +1 -0
  16. package/lib/commonjs/core/mixins/OxyServices.devices.js +119 -0
  17. package/lib/commonjs/core/mixins/OxyServices.devices.js.map +1 -0
  18. package/lib/commonjs/core/mixins/OxyServices.karma.js +117 -0
  19. package/lib/commonjs/core/mixins/OxyServices.karma.js.map +1 -0
  20. package/lib/commonjs/core/mixins/OxyServices.language.js +124 -0
  21. package/lib/commonjs/core/mixins/OxyServices.language.js.map +1 -0
  22. package/lib/commonjs/core/mixins/OxyServices.location.js +55 -0
  23. package/lib/commonjs/core/mixins/OxyServices.location.js.map +1 -0
  24. package/lib/commonjs/core/mixins/OxyServices.payment.js +66 -0
  25. package/lib/commonjs/core/mixins/OxyServices.payment.js.map +1 -0
  26. package/lib/commonjs/core/mixins/OxyServices.privacy.js +174 -0
  27. package/lib/commonjs/core/mixins/OxyServices.privacy.js.map +1 -0
  28. package/lib/commonjs/core/mixins/OxyServices.totp.js +53 -0
  29. package/lib/commonjs/core/mixins/OxyServices.totp.js.map +1 -0
  30. package/lib/commonjs/core/mixins/OxyServices.user.js +389 -0
  31. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -0
  32. package/lib/commonjs/core/mixins/OxyServices.utility.js +161 -0
  33. package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -0
  34. package/lib/commonjs/core/mixins/index.js +39 -0
  35. package/lib/commonjs/core/mixins/index.js.map +1 -0
  36. package/lib/commonjs/core/mixins/mixinHelpers.js +62 -0
  37. package/lib/commonjs/core/mixins/mixinHelpers.js.map +1 -0
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/ui/context/OxyContext.js +26 -47
  40. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  41. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +239 -1
  42. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  43. package/lib/commonjs/utils/apiUtils.js +0 -14
  44. package/lib/commonjs/utils/apiUtils.js.map +1 -1
  45. package/lib/commonjs/utils/asyncUtils.js +0 -20
  46. package/lib/commonjs/utils/asyncUtils.js.map +1 -1
  47. package/lib/module/core/OxyServices.base.js +265 -0
  48. package/lib/module/core/OxyServices.base.js.map +1 -0
  49. package/lib/module/core/OxyServices.errors.js +20 -0
  50. package/lib/module/core/OxyServices.errors.js.map +1 -0
  51. package/lib/module/core/OxyServices.js +43 -2005
  52. package/lib/module/core/OxyServices.js.map +1 -1
  53. package/lib/module/core/mixins/OxyServices.analytics.js +56 -0
  54. package/lib/module/core/mixins/OxyServices.analytics.js.map +1 -0
  55. package/lib/module/core/mixins/OxyServices.assets.js +402 -0
  56. package/lib/module/core/mixins/OxyServices.assets.js.map +1 -0
  57. package/lib/module/core/mixins/OxyServices.auth.js +299 -0
  58. package/lib/module/core/mixins/OxyServices.auth.js.map +1 -0
  59. package/lib/module/core/mixins/OxyServices.developer.js +111 -0
  60. package/lib/module/core/mixins/OxyServices.developer.js.map +1 -0
  61. package/lib/module/core/mixins/OxyServices.devices.js +115 -0
  62. package/lib/module/core/mixins/OxyServices.devices.js.map +1 -0
  63. package/lib/module/core/mixins/OxyServices.karma.js +113 -0
  64. package/lib/module/core/mixins/OxyServices.karma.js.map +1 -0
  65. package/lib/module/core/mixins/OxyServices.language.js +120 -0
  66. package/lib/module/core/mixins/OxyServices.language.js.map +1 -0
  67. package/lib/module/core/mixins/OxyServices.location.js +51 -0
  68. package/lib/module/core/mixins/OxyServices.location.js.map +1 -0
  69. package/lib/module/core/mixins/OxyServices.payment.js +62 -0
  70. package/lib/module/core/mixins/OxyServices.payment.js.map +1 -0
  71. package/lib/module/core/mixins/OxyServices.privacy.js +170 -0
  72. package/lib/module/core/mixins/OxyServices.privacy.js.map +1 -0
  73. package/lib/module/core/mixins/OxyServices.totp.js +49 -0
  74. package/lib/module/core/mixins/OxyServices.totp.js.map +1 -0
  75. package/lib/module/core/mixins/OxyServices.user.js +385 -0
  76. package/lib/module/core/mixins/OxyServices.user.js.map +1 -0
  77. package/lib/module/core/mixins/OxyServices.utility.js +156 -0
  78. package/lib/module/core/mixins/OxyServices.utility.js.map +1 -0
  79. package/lib/module/core/mixins/index.js +36 -0
  80. package/lib/module/core/mixins/index.js.map +1 -0
  81. package/lib/module/core/mixins/mixinHelpers.js +56 -0
  82. package/lib/module/core/mixins/mixinHelpers.js.map +1 -0
  83. package/lib/module/index.js.map +1 -1
  84. package/lib/module/ui/context/OxyContext.js +26 -47
  85. package/lib/module/ui/context/OxyContext.js.map +1 -1
  86. package/lib/module/ui/navigation/types.js.map +1 -1
  87. package/lib/module/ui/screens/PrivacySettingsScreen.js +241 -3
  88. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  89. package/lib/module/utils/apiUtils.js +0 -13
  90. package/lib/module/utils/apiUtils.js.map +1 -1
  91. package/lib/module/utils/asyncUtils.js +0 -20
  92. package/lib/module/utils/asyncUtils.js.map +1 -1
  93. package/lib/typescript/core/OxyServices.base.d.ts +123 -0
  94. package/lib/typescript/core/OxyServices.base.d.ts.map +1 -0
  95. package/lib/typescript/core/OxyServices.d.ts +969 -682
  96. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  97. package/lib/typescript/core/OxyServices.errors.d.ts +12 -0
  98. package/lib/typescript/core/OxyServices.errors.d.ts.map +1 -0
  99. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts +70 -0
  100. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -0
  101. package/lib/typescript/core/mixins/OxyServices.assets.d.ts +159 -0
  102. package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -0
  103. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +168 -0
  104. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -0
  105. package/lib/typescript/core/mixins/OxyServices.developer.d.ts +103 -0
  106. package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -0
  107. package/lib/typescript/core/mixins/OxyServices.devices.d.ts +93 -0
  108. package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -0
  109. package/lib/typescript/core/mixins/OxyServices.karma.d.ts +89 -0
  110. package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -0
  111. package/lib/typescript/core/mixins/OxyServices.language.d.ts +85 -0
  112. package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -0
  113. package/lib/typescript/core/mixins/OxyServices.location.d.ts +68 -0
  114. package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -0
  115. package/lib/typescript/core/mixins/OxyServices.payment.d.ts +74 -0
  116. package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -0
  117. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts +126 -0
  118. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -0
  119. package/lib/typescript/core/mixins/OxyServices.totp.d.ts +69 -0
  120. package/lib/typescript/core/mixins/OxyServices.totp.d.ts.map +1 -0
  121. package/lib/typescript/core/mixins/OxyServices.user.d.ts +189 -0
  122. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -0
  123. package/lib/typescript/core/mixins/OxyServices.utility.d.ts +97 -0
  124. package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -0
  125. package/lib/typescript/core/mixins/index.d.ts +898 -0
  126. package/lib/typescript/core/mixins/index.d.ts.map +1 -0
  127. package/lib/typescript/core/mixins/mixinHelpers.d.ts +32 -0
  128. package/lib/typescript/core/mixins/mixinHelpers.d.ts.map +1 -0
  129. package/lib/typescript/index.d.ts +1 -1
  130. package/lib/typescript/index.d.ts.map +1 -1
  131. package/lib/typescript/models/interfaces.d.ts +36 -0
  132. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  133. package/lib/typescript/ui/context/OxyContext.d.ts +2 -6
  134. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  135. package/lib/typescript/ui/navigation/types.d.ts +0 -1
  136. package/lib/typescript/ui/navigation/types.d.ts.map +1 -1
  137. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  138. package/lib/typescript/utils/apiUtils.d.ts +0 -7
  139. package/lib/typescript/utils/apiUtils.d.ts.map +1 -1
  140. package/lib/typescript/utils/asyncUtils.d.ts +0 -11
  141. package/lib/typescript/utils/asyncUtils.d.ts.map +1 -1
  142. package/package.json +1 -1
  143. package/src/core/OxyServices.base.ts +311 -0
  144. package/src/core/OxyServices.errors.ts +26 -0
  145. package/src/core/OxyServices.ts +43 -2026
  146. package/src/core/mixins/OxyServices.analytics.ts +53 -0
  147. package/src/core/mixins/OxyServices.assets.ts +390 -0
  148. package/src/core/mixins/OxyServices.auth.ts +275 -0
  149. package/src/core/mixins/OxyServices.developer.ts +114 -0
  150. package/src/core/mixins/OxyServices.devices.ts +103 -0
  151. package/src/core/mixins/OxyServices.karma.ts +111 -0
  152. package/src/core/mixins/OxyServices.language.ts +127 -0
  153. package/src/core/mixins/OxyServices.location.ts +46 -0
  154. package/src/core/mixins/OxyServices.payment.ts +59 -0
  155. package/src/core/mixins/OxyServices.privacy.ts +182 -0
  156. package/src/core/mixins/OxyServices.totp.ts +36 -0
  157. package/src/core/mixins/OxyServices.user.ts +380 -0
  158. package/src/core/mixins/OxyServices.utility.ts +187 -0
  159. package/src/core/mixins/index.ts +58 -0
  160. package/src/core/mixins/mixinHelpers.ts +69 -0
  161. package/src/index.ts +4 -0
  162. package/src/models/interfaces.ts +40 -0
  163. package/src/ui/context/OxyContext.tsx +35 -53
  164. package/src/ui/navigation/types.ts +0 -1
  165. package/src/ui/screens/PrivacySettingsScreen.tsx +240 -2
  166. package/src/utils/apiUtils.ts +0 -14
  167. package/src/utils/asyncUtils.ts +0 -20
  168. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js +0 -192
  169. package/lib/commonjs/ui/screens/internal/SignInPasswordStep.js.map +0 -1
  170. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js +0 -142
  171. package/lib/commonjs/ui/screens/internal/SignInUsernameStep.js.map +0 -1
  172. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js +0 -113
  173. package/lib/commonjs/ui/screens/internal/SignUpIdentityStep.js.map +0 -1
  174. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js +0 -132
  175. package/lib/commonjs/ui/screens/internal/SignUpSecurityStep.js.map +0 -1
  176. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js +0 -83
  177. package/lib/commonjs/ui/screens/internal/SignUpSummaryStep.js.map +0 -1
  178. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js +0 -58
  179. package/lib/commonjs/ui/screens/internal/SignUpWelcomeStep.js.map +0 -1
  180. package/lib/module/ui/screens/internal/SignInPasswordStep.js +0 -186
  181. package/lib/module/ui/screens/internal/SignInPasswordStep.js.map +0 -1
  182. package/lib/module/ui/screens/internal/SignInUsernameStep.js +0 -136
  183. package/lib/module/ui/screens/internal/SignInUsernameStep.js.map +0 -1
  184. package/lib/module/ui/screens/internal/SignUpIdentityStep.js +0 -108
  185. package/lib/module/ui/screens/internal/SignUpIdentityStep.js.map +0 -1
  186. package/lib/module/ui/screens/internal/SignUpSecurityStep.js +0 -127
  187. package/lib/module/ui/screens/internal/SignUpSecurityStep.js.map +0 -1
  188. package/lib/module/ui/screens/internal/SignUpSummaryStep.js +0 -78
  189. package/lib/module/ui/screens/internal/SignUpSummaryStep.js.map +0 -1
  190. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js +0 -53
  191. package/lib/module/ui/screens/internal/SignUpWelcomeStep.js.map +0 -1
  192. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts +0 -28
  193. package/lib/typescript/ui/screens/internal/SignInPasswordStep.d.ts.map +0 -1
  194. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts +0 -25
  195. package/lib/typescript/ui/screens/internal/SignInUsernameStep.d.ts.map +0 -1
  196. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts +0 -20
  197. package/lib/typescript/ui/screens/internal/SignUpIdentityStep.d.ts.map +0 -1
  198. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts +0 -24
  199. package/lib/typescript/ui/screens/internal/SignUpSecurityStep.d.ts.map +0 -1
  200. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts +0 -15
  201. package/lib/typescript/ui/screens/internal/SignUpSummaryStep.d.ts.map +0 -1
  202. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts +0 -13
  203. package/lib/typescript/ui/screens/internal/SignUpWelcomeStep.d.ts.map +0 -1
  204. package/src/ui/screens/internal/SignInPasswordStep.tsx +0 -184
  205. package/src/ui/screens/internal/SignInUsernameStep.tsx +0 -145
  206. package/src/ui/screens/internal/SignUpIdentityStep.tsx +0 -112
  207. package/src/ui/screens/internal/SignUpSecurityStep.tsx +0 -132
  208. package/src/ui/screens/internal/SignUpSummaryStep.tsx +0 -66
  209. package/src/ui/screens/internal/SignUpWelcomeStep.tsx +0 -52
@@ -1,697 +1,984 @@
1
- import type { OxyConfig as OxyConfigBase, ApiError, User, Notification, AssetInitResponse, AssetUrlResponse, AssetVariant } from '../models/interfaces';
2
- import type { LanguageMetadata } from '../utils/languageUtils';
3
1
  /**
4
- * OxyConfig - Configuration for OxyServices
5
- * @property baseURL - The Oxy API base URL (e.g., https://api.oxy.so)
6
- * @property cloudURL - The Oxy Cloud (file storage/CDN) URL (e.g., https://cloud.oxy.so)
7
- */
8
- export interface OxyConfig extends OxyConfigBase {
9
- cloudURL?: string;
10
- }
11
- import type { SessionLoginResponse } from '../models/session';
12
- import { type PaginationParams } from '../utils/apiUtils';
13
- import { HttpClient } from './HttpClient';
14
- /**
15
- * Custom error types for better error handling
2
+ * OxyServices - Unified client for Oxy API and Oxy Cloud
3
+ *
4
+ * # Usage Examples
5
+ *
6
+ * ## Browser (ESM/TypeScript)
7
+ *
8
+ * ```typescript
9
+ * import { OxyServices } from './core/OxyServices';
10
+ *
11
+ * const oxy = new OxyServices({
12
+ * baseURL: 'https://api.oxy.so',
13
+ * cloudURL: 'https://cloud.oxy.so',
14
+ * });
15
+ *
16
+ * // Authenticate and fetch user
17
+ * await oxy.setTokens('ACCESS_TOKEN');
18
+ * const user = await oxy.getCurrentUser();
19
+ *
20
+ * // Upload a file (browser File API)
21
+ * const fileInput = document.querySelector('input[type=file]');
22
+ * const file = fileInput.files[0];
23
+ * await oxy.uploadRawFile(file);
24
+ *
25
+ * // Get a file stream URL for <img src>
26
+ * const url = oxy.getFileStreamUrl('fileId');
27
+ * ```
28
+ *
29
+ * ## Node.js (CommonJS/TypeScript)
30
+ *
31
+ * ```typescript
32
+ * import { OxyServices } from './core/OxyServices';
33
+ * import fs from 'fs';
34
+ *
35
+ * const oxy = new OxyServices({
36
+ * baseURL: 'https://api.oxy.so',
37
+ * cloudURL: 'https://cloud.oxy.so',
38
+ * });
39
+ *
40
+ * // Authenticate and fetch user
41
+ * await oxy.setTokens('ACCESS_TOKEN');
42
+ * const user = await oxy.getCurrentUser();
43
+ *
44
+ * // Upload a file (Node.js Buffer)
45
+ * const buffer = fs.readFileSync('myfile.png');
46
+ * const blob = new Blob([buffer]);
47
+ * await oxy.uploadRawFile(blob, { filename: 'myfile.png' });
48
+ *
49
+ * // Get a file download URL
50
+ * const url = oxy.getFileDownloadUrl('fileId');
51
+ * ```
52
+ *
53
+ * ## Configuration
54
+ * - `baseURL`: Oxy API endpoint (e.g., https://api.oxy.so)
55
+ * - `cloudURL`: Oxy Cloud/CDN endpoint (e.g., https://cloud.oxy.so)
56
+ *
57
+ * See method JSDoc for more details and options.
16
58
  */
17
- export declare class OxyAuthenticationError extends Error {
18
- readonly code: string;
19
- readonly status: number;
20
- constructor(message: string, code?: string, status?: number);
21
- }
22
- export declare class OxyAuthenticationTimeoutError extends OxyAuthenticationError {
23
- constructor(operationName: string, timeoutMs: number);
24
- }
59
+ import { OxyServicesBase, type OxyConfig } from './OxyServices.base';
60
+ import { OxyAuthenticationError, OxyAuthenticationTimeoutError } from './OxyServices.errors';
25
61
  /**
26
62
  * OxyServices - Unified client library for interacting with the Oxy API
27
63
  *
28
64
  * This class provides all API functionality in one simple, easy-to-use interface.
29
- * Architecture:
30
- * - HttpClient: Handles HTTP communication and authentication
31
- * - RequestManager: Handles caching, deduplication, queuing, and retry
32
- * - OxyServices: Provides high-level API methods
65
+ *
66
+ * ## Architecture
67
+ * - **HttpClient**: Handles HTTP communication and authentication
68
+ * - **RequestManager**: Handles caching, deduplication, queuing, and retry
69
+ * - **OxyServices**: Provides high-level API methods
70
+ *
71
+ * ## Mixin Composition
72
+ * The class is composed using TypeScript mixins for better code organization:
73
+ * - **Base**: Core infrastructure (HTTP client, request management, error handling)
74
+ * - **Auth**: Authentication and session management
75
+ * - **User**: User profiles, follow, notifications
76
+ * - **TOTP**: Two-factor authentication enrollment
77
+ * - **Privacy**: Blocked and restricted users
78
+ * - **Language**: Language detection and metadata
79
+ * - **Payment**: Payment processing
80
+ * - **Karma**: Karma system
81
+ * - **Assets**: File upload and asset management
82
+ * - **Developer**: Developer API management
83
+ * - **Location**: Location-based features
84
+ * - **Analytics**: Analytics tracking
85
+ * - **Devices**: Device management
86
+ * - **Utility**: Utility methods and Express middleware
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * const oxy = new OxyServices({
91
+ * baseURL: 'https://api.oxy.so',
92
+ * cloudURL: 'https://cloud.oxy.so'
93
+ * });
94
+ * ```
33
95
  */
34
- export declare class OxyServices {
35
- private httpClient;
36
- private requestManager;
37
- private cloudURL;
38
- private config;
39
- /**
40
- * Creates a new instance of the OxyServices client
41
- * @param config - Configuration for the client
42
- * config.baseURL: Oxy API URL (e.g., https://api.oxy.so)
43
- * config.cloudURL: Oxy Cloud URL (e.g., https://cloud.oxy.so)
44
- */
45
- constructor(config: OxyConfig);
46
- static __resetTokensForTests(): void;
47
- /**
48
- * Make a request with all performance optimizations
49
- * This is the main method for all API calls - ensures authentication and performance features
50
- */
51
- private makeRequest;
52
- /**
53
- * Get the configured Oxy API base URL
54
- */
55
- getBaseURL(): string;
56
- /**
57
- * Get the HTTP client instance
58
- * Useful for advanced use cases where direct access to the HTTP client is needed
59
- */
60
- getClient(): HttpClient;
61
- /**
62
- * Get performance metrics
63
- */
64
- getMetrics(): {
65
- totalRequests: number;
66
- successfulRequests: number;
67
- failedRequests: number;
68
- cacheHits: number;
69
- cacheMisses: number;
70
- averageResponseTime: number;
96
+ declare const OxyServicesComposed: {
97
+ new (...args: any[]): {
98
+ fetchLinkMetadata(url: string): Promise<{
99
+ url: string;
100
+ title: string;
101
+ description: string;
102
+ image?: string;
103
+ }>;
104
+ auth(options?: {
105
+ debug?: boolean;
106
+ onError?: ((error: import(".").ApiError) => any) | undefined;
107
+ loadUser?: boolean;
108
+ session?: boolean;
109
+ }): (req: any, res: any, next: any) => any;
110
+ httpClient: import("./HttpClient").HttpClient;
111
+ requestManager: import("./RequestManager").RequestManager;
112
+ cloudURL: string;
113
+ config: OxyConfig;
114
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
115
+ getBaseURL(): string;
116
+ getClient(): import("./HttpClient").HttpClient;
117
+ getMetrics(): {
118
+ totalRequests: number;
119
+ successfulRequests: number;
120
+ failedRequests: number;
121
+ cacheHits: number;
122
+ cacheMisses: number;
123
+ averageResponseTime: number;
124
+ };
125
+ clearCache(): void;
126
+ clearCacheEntry(key: string): void;
127
+ getCacheStats(): {
128
+ size: number;
129
+ hits: number;
130
+ misses: number;
131
+ hitRate: number;
132
+ };
133
+ getCloudURL(): string;
134
+ setTokens(accessToken: string, refreshToken?: string): void;
135
+ clearTokens(): void;
136
+ getCurrentUserId(): string | null;
137
+ hasValidToken(): boolean;
138
+ getAccessToken(): string | null;
139
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
140
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
141
+ hasAccessToken(): boolean;
142
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
143
+ maxRetries?: number;
144
+ retryDelay?: number;
145
+ authTimeoutMs?: number;
146
+ }): Promise<T>;
147
+ validate(): Promise<boolean>;
148
+ handleError(error: any): Error;
149
+ healthCheck(): Promise<{
150
+ status: string;
151
+ users?: number;
152
+ timestamp?: string;
153
+ [key: string]: any;
154
+ }>;
155
+ };
156
+ __resetTokensForTests(): void;
157
+ } & {
158
+ new (...args: any[]): {
159
+ registerDevice(deviceData: any): Promise<any>;
160
+ getUserDevices(): Promise<any[]>;
161
+ removeDevice(deviceId: string): Promise<void>;
162
+ getDeviceSessions(sessionId: string): Promise<any[]>;
163
+ logoutAllDeviceSessions(sessionId: string, deviceId?: string, excludeCurrent?: boolean): Promise<any>;
164
+ updateDeviceName(sessionId: string, deviceName: string): Promise<any>;
165
+ httpClient: import("./HttpClient").HttpClient;
166
+ requestManager: import("./RequestManager").RequestManager;
167
+ cloudURL: string;
168
+ config: OxyConfig;
169
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
170
+ getBaseURL(): string;
171
+ getClient(): import("./HttpClient").HttpClient;
172
+ getMetrics(): {
173
+ totalRequests: number;
174
+ successfulRequests: number;
175
+ failedRequests: number;
176
+ cacheHits: number;
177
+ cacheMisses: number;
178
+ averageResponseTime: number;
179
+ };
180
+ clearCache(): void;
181
+ clearCacheEntry(key: string): void;
182
+ getCacheStats(): {
183
+ size: number;
184
+ hits: number;
185
+ misses: number;
186
+ hitRate: number;
187
+ };
188
+ getCloudURL(): string;
189
+ setTokens(accessToken: string, refreshToken?: string): void;
190
+ clearTokens(): void;
191
+ getCurrentUserId(): string | null;
192
+ hasValidToken(): boolean;
193
+ getAccessToken(): string | null;
194
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
195
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
196
+ hasAccessToken(): boolean;
197
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
198
+ maxRetries?: number;
199
+ retryDelay?: number;
200
+ authTimeoutMs?: number;
201
+ }): Promise<T>;
202
+ validate(): Promise<boolean>;
203
+ handleError(error: any): Error;
204
+ healthCheck(): Promise<{
205
+ status: string;
206
+ users?: number;
207
+ timestamp?: string;
208
+ [key: string]: any;
209
+ }>;
210
+ };
211
+ __resetTokensForTests(): void;
212
+ } & {
213
+ new (...args: any[]): {
214
+ trackEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
215
+ getAnalytics(startDate?: string, endDate?: string): Promise<any>;
216
+ httpClient: import("./HttpClient").HttpClient;
217
+ requestManager: import("./RequestManager").RequestManager;
218
+ cloudURL: string;
219
+ config: OxyConfig;
220
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
221
+ getBaseURL(): string;
222
+ getClient(): import("./HttpClient").HttpClient;
223
+ getMetrics(): {
224
+ totalRequests: number;
225
+ successfulRequests: number;
226
+ failedRequests: number;
227
+ cacheHits: number;
228
+ cacheMisses: number;
229
+ averageResponseTime: number;
230
+ };
231
+ clearCache(): void;
232
+ clearCacheEntry(key: string): void;
233
+ getCacheStats(): {
234
+ size: number;
235
+ hits: number;
236
+ misses: number;
237
+ hitRate: number;
238
+ };
239
+ getCloudURL(): string;
240
+ setTokens(accessToken: string, refreshToken?: string): void;
241
+ clearTokens(): void;
242
+ getCurrentUserId(): string | null;
243
+ hasValidToken(): boolean;
244
+ getAccessToken(): string | null;
245
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
246
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
247
+ hasAccessToken(): boolean;
248
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
249
+ maxRetries?: number;
250
+ retryDelay?: number;
251
+ authTimeoutMs?: number;
252
+ }): Promise<T>;
253
+ validate(): Promise<boolean>;
254
+ handleError(error: any): Error;
255
+ healthCheck(): Promise<{
256
+ status: string;
257
+ users?: number;
258
+ timestamp?: string;
259
+ [key: string]: any;
260
+ }>;
261
+ };
262
+ __resetTokensForTests(): void;
263
+ } & {
264
+ new (...args: any[]): {
265
+ updateLocation(latitude: number, longitude: number): Promise<any>;
266
+ getNearbyUsers(radius?: number): Promise<any[]>;
267
+ httpClient: import("./HttpClient").HttpClient;
268
+ requestManager: import("./RequestManager").RequestManager;
269
+ cloudURL: string;
270
+ config: OxyConfig;
271
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
272
+ getBaseURL(): string;
273
+ getClient(): import("./HttpClient").HttpClient;
274
+ getMetrics(): {
275
+ totalRequests: number;
276
+ successfulRequests: number;
277
+ failedRequests: number;
278
+ cacheHits: number;
279
+ cacheMisses: number;
280
+ averageResponseTime: number;
281
+ };
282
+ clearCache(): void;
283
+ clearCacheEntry(key: string): void;
284
+ getCacheStats(): {
285
+ size: number;
286
+ hits: number;
287
+ misses: number;
288
+ hitRate: number;
289
+ };
290
+ getCloudURL(): string;
291
+ setTokens(accessToken: string, refreshToken?: string): void;
292
+ clearTokens(): void;
293
+ getCurrentUserId(): string | null;
294
+ hasValidToken(): boolean;
295
+ getAccessToken(): string | null;
296
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
297
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
298
+ hasAccessToken(): boolean;
299
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
300
+ maxRetries?: number;
301
+ retryDelay?: number;
302
+ authTimeoutMs?: number;
303
+ }): Promise<T>;
304
+ validate(): Promise<boolean>;
305
+ handleError(error: any): Error;
306
+ healthCheck(): Promise<{
307
+ status: string;
308
+ users?: number;
309
+ timestamp?: string;
310
+ [key: string]: any;
311
+ }>;
312
+ };
313
+ __resetTokensForTests(): void;
314
+ } & {
315
+ new (...args: any[]): {
316
+ getDeveloperApps(): Promise<any[]>;
317
+ createDeveloperApp(data: {
318
+ name: string;
319
+ description?: string;
320
+ webhookUrl: string;
321
+ devWebhookUrl?: string;
322
+ scopes?: string[];
323
+ }): Promise<any>;
324
+ getDeveloperApp(appId: string): Promise<any>;
325
+ updateDeveloperApp(appId: string, data: {
326
+ name?: string;
327
+ description?: string;
328
+ webhookUrl?: string;
329
+ devWebhookUrl?: string;
330
+ scopes?: string[];
331
+ }): Promise<any>;
332
+ regenerateDeveloperAppSecret(appId: string): Promise<any>;
333
+ deleteDeveloperApp(appId: string): Promise<any>;
334
+ httpClient: import("./HttpClient").HttpClient;
335
+ requestManager: import("./RequestManager").RequestManager;
336
+ cloudURL: string;
337
+ config: OxyConfig;
338
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
339
+ getBaseURL(): string;
340
+ getClient(): import("./HttpClient").HttpClient;
341
+ getMetrics(): {
342
+ totalRequests: number;
343
+ successfulRequests: number;
344
+ failedRequests: number;
345
+ cacheHits: number;
346
+ cacheMisses: number;
347
+ averageResponseTime: number;
348
+ };
349
+ clearCache(): void;
350
+ clearCacheEntry(key: string): void;
351
+ getCacheStats(): {
352
+ size: number;
353
+ hits: number;
354
+ misses: number;
355
+ hitRate: number;
356
+ };
357
+ getCloudURL(): string;
358
+ setTokens(accessToken: string, refreshToken?: string): void;
359
+ clearTokens(): void;
360
+ getCurrentUserId(): string | null;
361
+ hasValidToken(): boolean;
362
+ getAccessToken(): string | null;
363
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
364
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
365
+ hasAccessToken(): boolean;
366
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
367
+ maxRetries?: number;
368
+ retryDelay?: number;
369
+ authTimeoutMs?: number;
370
+ }): Promise<T>;
371
+ validate(): Promise<boolean>;
372
+ handleError(error: any): Error;
373
+ healthCheck(): Promise<{
374
+ status: string;
375
+ users?: number;
376
+ timestamp?: string;
377
+ [key: string]: any;
378
+ }>;
379
+ };
380
+ __resetTokensForTests(): void;
381
+ } & {
382
+ new (...args: any[]): {
383
+ deleteFile(fileId: string): Promise<any>;
384
+ getFileDownloadUrl(fileId: string, variant?: string, expiresIn?: number): string;
385
+ getFileStreamUrl(fileId: string): string;
386
+ listUserFiles(limit?: number, offset?: number): Promise<{
387
+ files: any[];
388
+ total: number;
389
+ hasMore: boolean;
390
+ }>;
391
+ getFileContentAsText(fileId: string, variant?: string): Promise<string>;
392
+ getFileContentAsBlob(fileId: string, variant?: string): Promise<Blob>;
393
+ uploadRawFile(file: File | Blob, visibility?: "private" | "public" | "unlisted", metadata?: Record<string, any>): Promise<any>;
394
+ calculateSHA256(file: File | Blob): Promise<string>;
395
+ assetInit(sha256: string, size: number, mime: string): Promise<import(".").AssetInitResponse>;
396
+ assetComplete(fileId: string, originalName: string, size: number, mime: string, visibility?: "private" | "public" | "unlisted", metadata?: Record<string, any>): Promise<any>;
397
+ assetUpload(file: File, visibility?: "private" | "public" | "unlisted", metadata?: Record<string, any>, onProgress?: ((progress: number) => void) | undefined): Promise<any>;
398
+ uploadToPresignedUrl(url: string, file: File, onProgress?: ((progress: number) => void) | undefined): Promise<void>;
399
+ assetLink(fileId: string, app: string, entityType: string, entityId: string, visibility?: "private" | "public" | "unlisted", webhookUrl?: string): Promise<any>;
400
+ assetUnlink(fileId: string, app: string, entityType: string, entityId: string): Promise<any>;
401
+ assetGet(fileId: string): Promise<any>;
402
+ assetGetUrl(fileId: string, variant?: string, expiresIn?: number): Promise<import(".").AssetUrlResponse>;
403
+ assetRestore(fileId: string): Promise<any>;
404
+ assetDelete(fileId: string, force?: boolean): Promise<any>;
405
+ assetGetVariants(fileId: string): Promise<import(".").AssetVariant[]>;
406
+ assetUpdateVisibility(fileId: string, visibility: "private" | "public" | "unlisted"): Promise<any>;
407
+ uploadAvatar(file: File, userId: string, app?: string): Promise<any>;
408
+ uploadProfileBanner(file: File, userId: string, app?: string): Promise<any>;
409
+ httpClient: import("./HttpClient").HttpClient;
410
+ requestManager: import("./RequestManager").RequestManager;
411
+ cloudURL: string;
412
+ config: OxyConfig;
413
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
414
+ getBaseURL(): string;
415
+ getClient(): import("./HttpClient").HttpClient;
416
+ getMetrics(): {
417
+ totalRequests: number;
418
+ successfulRequests: number;
419
+ failedRequests: number;
420
+ cacheHits: number;
421
+ cacheMisses: number;
422
+ averageResponseTime: number;
423
+ };
424
+ clearCache(): void;
425
+ clearCacheEntry(key: string): void;
426
+ getCacheStats(): {
427
+ size: number;
428
+ hits: number;
429
+ misses: number;
430
+ hitRate: number;
431
+ };
432
+ getCloudURL(): string;
433
+ setTokens(accessToken: string, refreshToken?: string): void;
434
+ clearTokens(): void;
435
+ getCurrentUserId(): string | null;
436
+ hasValidToken(): boolean;
437
+ getAccessToken(): string | null;
438
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
439
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
440
+ hasAccessToken(): boolean;
441
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
442
+ maxRetries?: number;
443
+ retryDelay?: number;
444
+ authTimeoutMs?: number;
445
+ }): Promise<T>;
446
+ validate(): Promise<boolean>;
447
+ handleError(error: any): Error;
448
+ healthCheck(): Promise<{
449
+ status: string;
450
+ users?: number;
451
+ timestamp?: string;
452
+ [key: string]: any;
453
+ }>;
454
+ };
455
+ __resetTokensForTests(): void;
456
+ } & {
457
+ new (...args: any[]): {
458
+ getUserKarma(userId: string): Promise<any>;
459
+ giveKarma(userId: string, amount: number, reason?: string): Promise<any>;
460
+ getUserKarmaTotal(userId: string): Promise<any>;
461
+ getUserKarmaHistory(userId: string, limit?: number, offset?: number): Promise<any>;
462
+ getKarmaLeaderboard(): Promise<any>;
463
+ getKarmaRules(): Promise<any>;
464
+ httpClient: import("./HttpClient").HttpClient;
465
+ requestManager: import("./RequestManager").RequestManager;
466
+ cloudURL: string;
467
+ config: OxyConfig;
468
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
469
+ getBaseURL(): string;
470
+ getClient(): import("./HttpClient").HttpClient;
471
+ getMetrics(): {
472
+ totalRequests: number;
473
+ successfulRequests: number;
474
+ failedRequests: number;
475
+ cacheHits: number;
476
+ cacheMisses: number;
477
+ averageResponseTime: number;
478
+ };
479
+ clearCache(): void;
480
+ clearCacheEntry(key: string): void;
481
+ getCacheStats(): {
482
+ size: number;
483
+ hits: number;
484
+ misses: number;
485
+ hitRate: number;
486
+ };
487
+ getCloudURL(): string;
488
+ setTokens(accessToken: string, refreshToken?: string): void;
489
+ clearTokens(): void;
490
+ getCurrentUserId(): string | null;
491
+ hasValidToken(): boolean;
492
+ getAccessToken(): string | null;
493
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
494
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
495
+ hasAccessToken(): boolean;
496
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
497
+ maxRetries?: number;
498
+ retryDelay?: number;
499
+ authTimeoutMs?: number;
500
+ }): Promise<T>;
501
+ validate(): Promise<boolean>;
502
+ handleError(error: any): Error;
503
+ healthCheck(): Promise<{
504
+ status: string;
505
+ users?: number;
506
+ timestamp?: string;
507
+ [key: string]: any;
508
+ }>;
509
+ };
510
+ __resetTokensForTests(): void;
511
+ } & {
512
+ new (...args: any[]): {
513
+ createPayment(data: any): Promise<any>;
514
+ getPayment(paymentId: string): Promise<any>;
515
+ getUserPayments(): Promise<any[]>;
516
+ httpClient: import("./HttpClient").HttpClient;
517
+ requestManager: import("./RequestManager").RequestManager;
518
+ cloudURL: string;
519
+ config: OxyConfig;
520
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
521
+ getBaseURL(): string;
522
+ getClient(): import("./HttpClient").HttpClient;
523
+ getMetrics(): {
524
+ totalRequests: number;
525
+ successfulRequests: number;
526
+ failedRequests: number;
527
+ cacheHits: number;
528
+ cacheMisses: number;
529
+ averageResponseTime: number;
530
+ };
531
+ clearCache(): void;
532
+ clearCacheEntry(key: string): void;
533
+ getCacheStats(): {
534
+ size: number;
535
+ hits: number;
536
+ misses: number;
537
+ hitRate: number;
538
+ };
539
+ getCloudURL(): string;
540
+ setTokens(accessToken: string, refreshToken?: string): void;
541
+ clearTokens(): void;
542
+ getCurrentUserId(): string | null;
543
+ hasValidToken(): boolean;
544
+ getAccessToken(): string | null;
545
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
546
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
547
+ hasAccessToken(): boolean;
548
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
549
+ maxRetries?: number;
550
+ retryDelay?: number;
551
+ authTimeoutMs?: number;
552
+ }): Promise<T>;
553
+ validate(): Promise<boolean>;
554
+ handleError(error: any): Error;
555
+ healthCheck(): Promise<{
556
+ status: string;
557
+ users?: number;
558
+ timestamp?: string;
559
+ [key: string]: any;
560
+ }>;
561
+ };
562
+ __resetTokensForTests(): void;
563
+ } & {
564
+ new (...args: any[]): {
565
+ getStorage(): Promise<{
566
+ getItem: (key: string) => Promise<string | null>;
567
+ setItem: (key: string, value: string) => Promise<void>;
568
+ removeItem: (key: string) => Promise<void>;
569
+ }>;
570
+ getCurrentLanguage(storageKeyPrefix?: string): Promise<string | null>;
571
+ getCurrentLanguageMetadata(storageKeyPrefix?: string): Promise<import(".").LanguageMetadata | null>;
572
+ getCurrentLanguageName(storageKeyPrefix?: string): Promise<string | null>;
573
+ getCurrentNativeLanguageName(storageKeyPrefix?: string): Promise<string | null>;
574
+ httpClient: import("./HttpClient").HttpClient;
575
+ requestManager: import("./RequestManager").RequestManager;
576
+ cloudURL: string;
577
+ config: OxyConfig;
578
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
579
+ getBaseURL(): string;
580
+ getClient(): import("./HttpClient").HttpClient;
581
+ getMetrics(): {
582
+ totalRequests: number;
583
+ successfulRequests: number;
584
+ failedRequests: number;
585
+ cacheHits: number;
586
+ cacheMisses: number;
587
+ averageResponseTime: number;
588
+ };
589
+ clearCache(): void;
590
+ clearCacheEntry(key: string): void;
591
+ getCacheStats(): {
592
+ size: number;
593
+ hits: number;
594
+ misses: number;
595
+ hitRate: number;
596
+ };
597
+ getCloudURL(): string;
598
+ setTokens(accessToken: string, refreshToken?: string): void;
599
+ clearTokens(): void;
600
+ getCurrentUserId(): string | null;
601
+ hasValidToken(): boolean;
602
+ getAccessToken(): string | null;
603
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
604
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
605
+ hasAccessToken(): boolean;
606
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
607
+ maxRetries?: number;
608
+ retryDelay?: number;
609
+ authTimeoutMs?: number;
610
+ }): Promise<T>;
611
+ validate(): Promise<boolean>;
612
+ handleError(error: any): Error;
613
+ healthCheck(): Promise<{
614
+ status: string;
615
+ users?: number;
616
+ timestamp?: string;
617
+ [key: string]: any;
618
+ }>;
71
619
  };
72
- /**
73
- * Clear request cache
74
- */
75
- clearCache(): void;
76
- /**
77
- * Clear specific cache entry
78
- */
79
- clearCacheEntry(key: string): void;
80
- /**
81
- * Get cache statistics
82
- */
83
- getCacheStats(): {
84
- size: number;
85
- hits: number;
86
- misses: number;
87
- hitRate: number;
620
+ __resetTokensForTests(): void;
621
+ } & {
622
+ new (...args: any[]): {
623
+ extractUserId(userIdField: string | {
624
+ _id: string;
625
+ username?: string;
626
+ avatar?: string;
627
+ }): string;
628
+ isUserInList<T extends import(".").BlockedUser | import(".").RestrictedUser>(userId: string, getUserList: () => Promise<T[]>, getIdField: (item: T) => string | {
629
+ _id: string;
630
+ username?: string;
631
+ avatar?: string;
632
+ }): Promise<boolean>;
633
+ getBlockedUsers(): Promise<import(".").BlockedUser[]>;
634
+ blockUser(userId: string): Promise<{
635
+ message: string;
636
+ }>;
637
+ unblockUser(userId: string): Promise<{
638
+ message: string;
639
+ }>;
640
+ isUserBlocked(userId: string): Promise<boolean>;
641
+ getRestrictedUsers(): Promise<import(".").RestrictedUser[]>;
642
+ restrictUser(userId: string): Promise<{
643
+ message: string;
644
+ }>;
645
+ unrestrictUser(userId: string): Promise<{
646
+ message: string;
647
+ }>;
648
+ isUserRestricted(userId: string): Promise<boolean>;
649
+ httpClient: import("./HttpClient").HttpClient;
650
+ requestManager: import("./RequestManager").RequestManager;
651
+ cloudURL: string;
652
+ config: OxyConfig;
653
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
654
+ getBaseURL(): string;
655
+ getClient(): import("./HttpClient").HttpClient;
656
+ getMetrics(): {
657
+ totalRequests: number;
658
+ successfulRequests: number;
659
+ failedRequests: number;
660
+ cacheHits: number;
661
+ cacheMisses: number;
662
+ averageResponseTime: number;
663
+ };
664
+ clearCache(): void;
665
+ clearCacheEntry(key: string): void;
666
+ getCacheStats(): {
667
+ size: number;
668
+ hits: number;
669
+ misses: number;
670
+ hitRate: number;
671
+ };
672
+ getCloudURL(): string;
673
+ setTokens(accessToken: string, refreshToken?: string): void;
674
+ clearTokens(): void;
675
+ getCurrentUserId(): string | null;
676
+ hasValidToken(): boolean;
677
+ getAccessToken(): string | null;
678
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
679
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
680
+ hasAccessToken(): boolean;
681
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
682
+ maxRetries?: number;
683
+ retryDelay?: number;
684
+ authTimeoutMs?: number;
685
+ }): Promise<T>;
686
+ validate(): Promise<boolean>;
687
+ handleError(error: any): Error;
688
+ healthCheck(): Promise<{
689
+ status: string;
690
+ users?: number;
691
+ timestamp?: string;
692
+ [key: string]: any;
693
+ }>;
88
694
  };
89
- /**
90
- * Get the configured Oxy Cloud (file storage/CDN) URL
91
- */
92
- getCloudURL(): string;
93
- /**
94
- * Set authentication tokens
95
- */
96
- setTokens(accessToken: string, refreshToken?: string): void;
97
- /**
98
- * Clear stored authentication tokens
99
- */
100
- clearTokens(): void;
101
- /**
102
- * Get the current user ID from the access token
103
- */
104
- getCurrentUserId(): string | null;
105
- /**
106
- * Check if the client has a valid access token
107
- */
108
- private hasAccessToken;
109
- /**
110
- * Check if the client has a valid access token (public method)
111
- */
112
- hasValidToken(): boolean;
113
- /**
114
- * Get the raw access token (for constructing anchor URLs when needed)
115
- */
116
- getAccessToken(): string | null;
117
- /**
118
- * Wait for authentication to be ready (public method)
119
- * Useful for apps that want to ensure authentication is complete before proceeding
120
- */
121
- waitForAuth(timeoutMs?: number): Promise<boolean>;
122
- /**
123
- * Wait for authentication to be ready with timeout
124
- */
125
- private waitForAuthentication;
126
- /**
127
- * Execute a function with automatic authentication retry logic
128
- * This handles the common case where API calls are made before authentication completes
129
- */
130
- private withAuthRetry;
131
- /**
132
- * Validate the current access token with the server
133
- */
134
- validate(): Promise<boolean>;
135
- /**
136
- * Centralized error handling
137
- */
138
- protected handleError(error: any): Error;
139
- /**
140
- * Health check endpoint
141
- */
142
- healthCheck(): Promise<{
143
- status: string;
144
- users?: number;
145
- timestamp?: string;
146
- [key: string]: any;
147
- }>;
148
- /**
149
- * Sign up a new user
150
- */
151
- signUp(username: string, email: string, password: string): Promise<{
152
- message: string;
153
- token: string;
154
- user: User;
155
- }>;
156
- /**
157
- * Request account recovery (send verification code)
158
- */
159
- requestRecovery(identifier: string): Promise<{
160
- delivery?: string;
161
- destination?: string;
162
- }>;
163
- /**
164
- * Verify recovery code
165
- */
166
- verifyRecoveryCode(identifier: string, code: string): Promise<{
167
- verified: boolean;
168
- }>;
169
- /**
170
- * Reset password using verified code
171
- */
172
- resetPassword(identifier: string, code: string, newPassword: string): Promise<{
173
- success: boolean;
174
- }>;
175
- /**
176
- * Reset password using TOTP code (recommended recovery)
177
- */
178
- resetPasswordWithTotp(identifier: string, code: string, newPassword: string): Promise<{
179
- success: boolean;
180
- }>;
181
- resetPasswordWithBackupCode(identifier: string, backupCode: string, newPassword: string): Promise<{
182
- success: boolean;
183
- }>;
184
- resetPasswordWithRecoveryKey(identifier: string, recoveryKey: string, newPassword: string): Promise<{
185
- success: boolean;
186
- nextRecoveryKey?: string;
187
- }>;
188
- /**
189
- * Sign in with device management
190
- */
191
- signIn(username: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse | {
192
- mfaRequired: true;
193
- mfaToken: string;
194
- expiresAt: string;
195
- }>;
196
- /**
197
- * Complete login by verifying TOTP with MFA token
198
- */
199
- verifyTotpLogin(mfaToken: string, code: string): Promise<SessionLoginResponse>;
200
- /**
201
- * Get user by session ID
202
- */
203
- getUserBySession(sessionId: string): Promise<User>;
204
- /**
205
- * Batch get multiple user profiles by session IDs (optimized for account switching)
206
- * Returns array of { sessionId, user } objects
207
- */
208
- getUsersBySessions(sessionIds: string[]): Promise<Array<{
209
- sessionId: string;
210
- user: User | null;
211
- }>>;
212
- /**
213
- * Get access token by session ID and set it in the token store
214
- */
215
- getTokenBySession(sessionId: string): Promise<{
216
- accessToken: string;
217
- expiresAt: string;
218
- }>;
219
- /**
220
- * Get sessions by session ID
221
- */
222
- getSessionsBySessionId(sessionId: string): Promise<any[]>;
223
- /**
224
- * Logout from a specific session
225
- */
226
- logoutSession(sessionId: string, targetSessionId?: string): Promise<void>;
227
- /**
228
- * Logout from all sessions
229
- */
230
- logoutAllSessions(sessionId: string): Promise<void>;
231
- /**
232
- * Validate session
233
- */
234
- validateSession(sessionId: string, options?: {
235
- deviceFingerprint?: string;
236
- useHeaderValidation?: boolean;
237
- }): Promise<{
238
- valid: boolean;
239
- expiresAt: string;
240
- lastActivity: string;
241
- user: User;
242
- sessionId?: string;
243
- source?: string;
244
- }>;
245
- /**
246
- * Check username availability
247
- */
248
- checkUsernameAvailability(username: string): Promise<{
249
- available: boolean;
250
- message: string;
251
- }>;
252
- /**
253
- * Check email availability
254
- */
255
- checkEmailAvailability(email: string): Promise<{
256
- available: boolean;
257
- message: string;
258
- }>;
259
- /**
260
- * Get profile by username
261
- */
262
- getProfileByUsername(username: string): Promise<User>;
263
- startTotpEnrollment(sessionId: string): Promise<{
264
- secret: string;
265
- otpauthUrl: string;
266
- issuer: string;
267
- label: string;
268
- }>;
269
- verifyTotpEnrollment(sessionId: string, code: string): Promise<{
270
- enabled: boolean;
271
- backupCodes?: string[];
272
- recoveryKey?: string;
273
- }>;
274
- disableTotp(sessionId: string, code: string): Promise<{
275
- disabled: boolean;
276
- }>;
277
- /**
278
- * Search user profiles
279
- */
280
- searchProfiles(query: string, pagination?: PaginationParams): Promise<User[]>;
281
- /**
282
- * Get profile recommendations
283
- */
284
- getProfileRecommendations(): Promise<Array<{
285
- id: string;
286
- username: string;
287
- name?: {
288
- first?: string;
289
- last?: string;
290
- full?: string;
695
+ __resetTokensForTests(): void;
696
+ } & {
697
+ new (...args: any[]): {
698
+ startTotpEnrollment(sessionId: string): Promise<{
699
+ secret: string;
700
+ otpauthUrl: string;
701
+ issuer: string;
702
+ label: string;
703
+ }>;
704
+ verifyTotpEnrollment(sessionId: string, code: string): Promise<{
705
+ enabled: boolean;
706
+ backupCodes?: string[];
707
+ recoveryKey?: string;
708
+ }>;
709
+ disableTotp(sessionId: string, code: string): Promise<{
710
+ disabled: boolean;
711
+ }>;
712
+ httpClient: import("./HttpClient").HttpClient;
713
+ requestManager: import("./RequestManager").RequestManager;
714
+ cloudURL: string;
715
+ config: OxyConfig;
716
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
717
+ getBaseURL(): string;
718
+ getClient(): import("./HttpClient").HttpClient;
719
+ getMetrics(): {
720
+ totalRequests: number;
721
+ successfulRequests: number;
722
+ failedRequests: number;
723
+ cacheHits: number;
724
+ cacheMisses: number;
725
+ averageResponseTime: number;
291
726
  };
292
- description?: string;
293
- _count?: {
294
- followers: number;
295
- following: number;
727
+ clearCache(): void;
728
+ clearCacheEntry(key: string): void;
729
+ getCacheStats(): {
730
+ size: number;
731
+ hits: number;
732
+ misses: number;
733
+ hitRate: number;
296
734
  };
297
- [key: string]: any;
298
- }>>;
299
- /**
300
- * Get user by ID
301
- */
302
- getUserById(userId: string): Promise<User>;
303
- /**
304
- * Get current user
305
- */
306
- getCurrentUser(): Promise<User>;
307
- /**
308
- * Update user profile
309
- */
310
- updateProfile(updates: Record<string, any>): Promise<User>;
311
- /**
312
- * Get privacy settings for a user
313
- * @param userId - The user ID (defaults to current user)
314
- */
315
- getPrivacySettings(userId?: string): Promise<any>;
316
- /**
317
- * Update privacy settings
318
- * @param settings - Partial privacy settings object
319
- * @param userId - The user ID (defaults to current user)
320
- */
321
- updatePrivacySettings(settings: Record<string, any>, userId?: string): Promise<any>;
322
- /**
323
- * Request account verification
324
- */
325
- requestAccountVerification(reason: string, evidence?: string): Promise<{
326
- message: string;
327
- requestId: string;
328
- }>;
329
- /**
330
- * Download account data export
331
- */
332
- downloadAccountData(format?: 'json' | 'csv'): Promise<Blob>;
333
- /**
334
- * Delete account permanently
335
- * @param password - User password for confirmation
336
- * @param confirmText - Confirmation text (usually username)
337
- */
338
- deleteAccount(password: string, confirmText: string): Promise<{
339
- message: string;
340
- }>;
341
- /**
342
- * Get the current language from storage or user profile
343
- * @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
344
- * @returns The current language code (e.g., 'en-US') or null if not set
345
- */
346
- getCurrentLanguage(storageKeyPrefix?: string): Promise<string | null>;
347
- /**
348
- * Get the current language with metadata (name, nativeName, etc.)
349
- * @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
350
- * @returns Language metadata object or null if not set
351
- */
352
- getCurrentLanguageMetadata(storageKeyPrefix?: string): Promise<LanguageMetadata | null>;
353
- /**
354
- * Get the current language name (e.g., 'English')
355
- * @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
356
- * @returns Language name or null if not set
357
- */
358
- getCurrentLanguageName(storageKeyPrefix?: string): Promise<string | null>;
359
- /**
360
- * Get the current native language name (e.g., 'Español')
361
- * @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
362
- * @returns Native language name or null if not set
363
- */
364
- getCurrentNativeLanguageName(storageKeyPrefix?: string): Promise<string | null>;
365
- /**
366
- * Get appropriate storage for the platform (similar to DeviceManager)
367
- * @private
368
- */
369
- private getStorage;
370
- /**
371
- * Update user by ID (admin function)
372
- */
373
- updateUser(userId: string, updates: Record<string, any>): Promise<User>;
374
- /**
375
- * Follow a user
376
- */
377
- followUser(userId: string): Promise<{
378
- success: boolean;
379
- message: string;
380
- }>;
381
- /**
382
- * Unfollow a user
383
- */
384
- unfollowUser(userId: string): Promise<{
385
- success: boolean;
386
- message: string;
387
- }>;
388
- /**
389
- * Get follow status
390
- */
391
- getFollowStatus(userId: string): Promise<{
392
- isFollowing: boolean;
393
- }>;
394
- /**
395
- * Get user followers
396
- */
397
- getUserFollowers(userId: string, pagination?: PaginationParams): Promise<{
398
- followers: User[];
399
- total: number;
400
- hasMore: boolean;
401
- }>;
402
- /**
403
- * Get user following
404
- */
405
- getUserFollowing(userId: string, pagination?: PaginationParams): Promise<{
406
- following: User[];
407
- total: number;
408
- hasMore: boolean;
409
- }>;
410
- /**
411
- * Get notifications
412
- */
413
- getNotifications(): Promise<Notification[]>;
414
- /**
415
- * Get unread notification count
416
- */
417
- getUnreadCount(): Promise<number>;
418
- /**
419
- * Create notification
420
- */
421
- createNotification(data: Partial<Notification>): Promise<Notification>;
422
- /**
423
- * Mark notification as read
424
- */
425
- markNotificationAsRead(notificationId: string): Promise<void>;
426
- /**
427
- * Mark all notifications as read
428
- */
429
- markAllNotificationsAsRead(): Promise<void>;
430
- /**
431
- * Delete notification
432
- */
433
- deleteNotification(notificationId: string): Promise<void>;
434
- /**
435
- * Create a payment
436
- */
437
- createPayment(data: any): Promise<any>;
438
- /**
439
- * Get payment by ID
440
- */
441
- getPayment(paymentId: string): Promise<any>;
442
- /**
443
- * Get user payments
444
- */
445
- getUserPayments(): Promise<any[]>;
446
- /**
447
- * Get user karma
448
- */
449
- getUserKarma(userId: string): Promise<any>;
450
- /**
451
- * Give karma to user
452
- */
453
- giveKarma(userId: string, amount: number, reason?: string): Promise<any>;
454
- /**
455
- * Get user karma total
456
- */
457
- getUserKarmaTotal(userId: string): Promise<any>;
458
- /**
459
- * Get user karma history
460
- */
461
- getUserKarmaHistory(userId: string, limit?: number, offset?: number): Promise<any>;
462
- /**
463
- * Get karma leaderboard
464
- */
465
- getKarmaLeaderboard(): Promise<any>;
466
- /**
467
- * Get karma rules
468
- */
469
- getKarmaRules(): Promise<any>;
470
- /**
471
- * Delete file
472
- */
473
- deleteFile(fileId: string): Promise<any>;
474
- /**
475
- * Get file download URL (API streaming proxy, attaches token for <img src>)
476
- */
477
- getFileDownloadUrl(fileId: string, variant?: string, expiresIn?: number): string;
478
- /**
479
- * Get file stream URL (direct Oxy Cloud/CDN URL, no token)
480
- */
481
- getFileStreamUrl(fileId: string): string;
482
- /**
483
- * List user files
484
- */
485
- listUserFiles(limit?: number, offset?: number): Promise<{
486
- files: any[];
487
- total: number;
488
- hasMore: boolean;
489
- }>;
490
- /**
491
- * Get file content as text
492
- */
493
- getFileContentAsText(fileId: string, variant?: string): Promise<string>;
494
- /**
495
- * Get file content as blob
496
- */
497
- getFileContentAsBlob(fileId: string, variant?: string): Promise<Blob>;
498
- /**
499
- * Upload raw file data
500
- */
501
- uploadRawFile(file: File | Blob, visibility?: 'private' | 'public' | 'unlisted', metadata?: Record<string, any>): Promise<any>;
502
- /**
503
- * Calculate SHA256 hash of file content
504
- */
505
- calculateSHA256(file: File | Blob): Promise<string>;
506
- /**
507
- * Initialize asset upload - returns pre-signed URL and file ID
508
- */
509
- assetInit(sha256: string, size: number, mime: string): Promise<AssetInitResponse>;
510
- /**
511
- * Complete asset upload - commit metadata and trigger variant generation
512
- */
513
- assetComplete(fileId: string, originalName: string, size: number, mime: string, visibility?: 'private' | 'public' | 'unlisted', metadata?: Record<string, any>): Promise<any>;
514
- /**
515
- * Upload file using Central Asset Service
516
- */
517
- assetUpload(file: File, visibility?: 'private' | 'public' | 'unlisted', metadata?: Record<string, any>, onProgress?: (progress: number) => void): Promise<any>;
518
- /**
519
- * Upload file to pre-signed URL
520
- */
521
- private uploadToPresignedUrl;
522
- /**
523
- * Link asset to an entity
524
- */
525
- assetLink(fileId: string, app: string, entityType: string, entityId: string, visibility?: 'private' | 'public' | 'unlisted', webhookUrl?: string): Promise<any>;
526
- /**
527
- * Unlink asset from an entity
528
- */
529
- assetUnlink(fileId: string, app: string, entityType: string, entityId: string): Promise<any>;
530
- /**
531
- * Get asset metadata
532
- */
533
- assetGet(fileId: string): Promise<any>;
534
- /**
535
- * Get asset URL (CDN or signed URL)
536
- */
537
- assetGetUrl(fileId: string, variant?: string, expiresIn?: number): Promise<AssetUrlResponse>;
538
- /**
539
- * Restore asset from trash
540
- */
541
- assetRestore(fileId: string): Promise<any>;
542
- /**
543
- * Delete asset with optional force
544
- */
545
- assetDelete(fileId: string, force?: boolean): Promise<any>;
546
- /**
547
- * Get list of available variants for an asset
548
- */
549
- assetGetVariants(fileId: string): Promise<AssetVariant[]>;
550
- /**
551
- * Update asset visibility
552
- * @param fileId - The file ID
553
- * @param visibility - New visibility level ('private', 'public', or 'unlisted')
554
- * @returns Updated asset information
555
- */
556
- assetUpdateVisibility(fileId: string, visibility: 'private' | 'public' | 'unlisted'): Promise<any>;
557
- /**
558
- * Helper: Upload and link avatar with automatic public visibility
559
- * @param file - The avatar file
560
- * @param userId - User ID to link to
561
- * @param app - App name (defaults to 'profiles')
562
- * @returns The uploaded and linked asset
563
- */
564
- uploadAvatar(file: File, userId: string, app?: string): Promise<any>;
565
- /**
566
- * Helper: Upload and link profile banner with automatic public visibility
567
- * @param file - The banner file
568
- * @param userId - User ID to link to
569
- * @param app - App name (defaults to 'profiles')
570
- * @returns The uploaded and linked asset
571
- */
572
- uploadProfileBanner(file: File, userId: string, app?: string): Promise<any>;
573
- /**
574
- * Get developer apps for the current user
575
- */
576
- getDeveloperApps(): Promise<any[]>;
577
- /**
578
- * Create a new developer app
579
- */
580
- createDeveloperApp(data: {
581
- name: string;
582
- description?: string;
583
- webhookUrl: string;
584
- devWebhookUrl?: string;
585
- scopes?: string[];
586
- }): Promise<any>;
587
- /**
588
- * Get a specific developer app
589
- */
590
- getDeveloperApp(appId: string): Promise<any>;
591
- /**
592
- * Update a developer app
593
- */
594
- updateDeveloperApp(appId: string, data: {
595
- name?: string;
596
- description?: string;
597
- webhookUrl?: string;
598
- devWebhookUrl?: string;
599
- scopes?: string[];
600
- }): Promise<any>;
601
- /**
602
- * Regenerate API secret for a developer app
603
- */
604
- regenerateDeveloperAppSecret(appId: string): Promise<any>;
605
- /**
606
- * Delete a developer app
607
- */
608
- deleteDeveloperApp(appId: string): Promise<any>;
609
- /**
610
- * Update user location
611
- */
612
- updateLocation(latitude: number, longitude: number): Promise<any>;
613
- /**
614
- * Get nearby users
615
- */
616
- getNearbyUsers(radius?: number): Promise<any[]>;
617
- /**
618
- * Track event
619
- */
620
- trackEvent(eventName: string, properties?: Record<string, any>): Promise<void>;
621
- /**
622
- * Get analytics data
623
- */
624
- getAnalytics(startDate?: string, endDate?: string): Promise<any>;
625
- /**
626
- * Register device
627
- */
628
- registerDevice(deviceData: any): Promise<any>;
629
- /**
630
- * Get user devices
631
- */
632
- getUserDevices(): Promise<any[]>;
633
- /**
634
- * Remove device
635
- */
636
- removeDevice(deviceId: string): Promise<void>;
637
- /**
638
- * Get device sessions
639
- * Note: Not cached by default to ensure fresh data, but can be cached via makeRequest if needed
640
- */
641
- getDeviceSessions(sessionId: string): Promise<any[]>;
642
- /**
643
- * Logout all device sessions
644
- */
645
- logoutAllDeviceSessions(sessionId: string, deviceId?: string, excludeCurrent?: boolean): Promise<any>;
646
- /**
647
- * Update device name
648
- */
649
- updateDeviceName(sessionId: string, deviceName: string): Promise<any>;
650
- /**
651
- * Fetch link metadata
652
- */
653
- fetchLinkMetadata(url: string): Promise<{
654
- url: string;
655
- title: string;
656
- description: string;
657
- image?: string;
658
- }>;
659
- /**
660
- * Simple Express.js authentication middleware
661
- *
662
- * Built-in authentication middleware that validates JWT tokens and adds user data to requests.
663
- *
664
- * @example
665
- * ```typescript
666
- * // Basic usage - just add it to your routes
667
- * app.use('/api/protected', oxyServices.auth());
668
- *
669
- * // With debug logging
670
- * app.use('/api/protected', oxyServices.auth({ debug: true }));
671
- *
672
- * // With custom error handling
673
- * app.use('/api/protected', oxyServices.auth({
674
- * onError: (error) => console.error('Auth failed:', error)
675
- * }));
676
- *
677
- * // Load full user data
678
- * app.use('/api/protected', oxyServices.auth({ loadUser: true }));
679
- * ```
680
- *
681
- * @param options Optional configuration
682
- * @param options.debug Enable debug logging (default: false)
683
- * @param options.onError Custom error handler
684
- * @param options.loadUser Load full user data (default: false for performance)
685
- * @param options.session Use session-based validation (default: false)
686
- * @returns Express middleware function
687
- */
688
- auth(options?: {
689
- debug?: boolean;
690
- onError?: (error: ApiError) => any;
691
- loadUser?: boolean;
692
- session?: boolean;
693
- }): (req: any, res: any, next: any) => any;
735
+ getCloudURL(): string;
736
+ setTokens(accessToken: string, refreshToken?: string): void;
737
+ clearTokens(): void;
738
+ getCurrentUserId(): string | null;
739
+ hasValidToken(): boolean;
740
+ getAccessToken(): string | null;
741
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
742
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
743
+ hasAccessToken(): boolean;
744
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
745
+ maxRetries?: number;
746
+ retryDelay?: number;
747
+ authTimeoutMs?: number;
748
+ }): Promise<T>;
749
+ validate(): Promise<boolean>;
750
+ handleError(error: any): Error;
751
+ healthCheck(): Promise<{
752
+ status: string;
753
+ users?: number;
754
+ timestamp?: string;
755
+ [key: string]: any;
756
+ }>;
757
+ };
758
+ __resetTokensForTests(): void;
759
+ } & {
760
+ new (...args: any[]): {
761
+ getProfileByUsername(username: string): Promise<import(".").User>;
762
+ searchProfiles(query: string, pagination?: import("..").PaginationParams): Promise<import(".").SearchProfilesResponse>;
763
+ getProfileRecommendations(): Promise<{
764
+ [key: string]: any;
765
+ id: string;
766
+ username: string;
767
+ name?: {
768
+ first?: string;
769
+ last?: string;
770
+ full?: string;
771
+ } | undefined;
772
+ description?: string;
773
+ _count?: {
774
+ followers: number;
775
+ following: number;
776
+ } | undefined;
777
+ }[]>;
778
+ getUserById(userId: string): Promise<import(".").User>;
779
+ getCurrentUser(): Promise<import(".").User>;
780
+ updateProfile(updates: Record<string, any>): Promise<import(".").User>;
781
+ getPrivacySettings(userId?: string): Promise<any>;
782
+ updatePrivacySettings(settings: Record<string, any>, userId?: string): Promise<any>;
783
+ requestAccountVerification(reason: string, evidence?: string): Promise<{
784
+ message: string;
785
+ requestId: string;
786
+ }>;
787
+ downloadAccountData(format?: "json" | "csv"): Promise<Blob>;
788
+ deleteAccount(password: string, confirmText: string): Promise<{
789
+ message: string;
790
+ }>;
791
+ updateUser(userId: string, updates: Record<string, any>): Promise<import(".").User>;
792
+ followUser(userId: string): Promise<{
793
+ success: boolean;
794
+ message: string;
795
+ }>;
796
+ unfollowUser(userId: string): Promise<{
797
+ success: boolean;
798
+ message: string;
799
+ }>;
800
+ getFollowStatus(userId: string): Promise<{
801
+ isFollowing: boolean;
802
+ }>;
803
+ getUserFollowers(userId: string, pagination?: import("..").PaginationParams): Promise<{
804
+ followers: import(".").User[];
805
+ total: number;
806
+ hasMore: boolean;
807
+ }>;
808
+ getUserFollowing(userId: string, pagination?: import("..").PaginationParams): Promise<{
809
+ following: import(".").User[];
810
+ total: number;
811
+ hasMore: boolean;
812
+ }>;
813
+ getNotifications(): Promise<import(".").Notification[]>;
814
+ getUnreadCount(): Promise<number>;
815
+ createNotification(data: Partial<import(".").Notification>): Promise<import(".").Notification>;
816
+ markNotificationAsRead(notificationId: string): Promise<void>;
817
+ markAllNotificationsAsRead(): Promise<void>;
818
+ deleteNotification(notificationId: string): Promise<void>;
819
+ httpClient: import("./HttpClient").HttpClient;
820
+ requestManager: import("./RequestManager").RequestManager;
821
+ cloudURL: string;
822
+ config: OxyConfig;
823
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
824
+ getBaseURL(): string;
825
+ getClient(): import("./HttpClient").HttpClient;
826
+ getMetrics(): {
827
+ totalRequests: number;
828
+ successfulRequests: number;
829
+ failedRequests: number;
830
+ cacheHits: number;
831
+ cacheMisses: number;
832
+ averageResponseTime: number;
833
+ };
834
+ clearCache(): void;
835
+ clearCacheEntry(key: string): void;
836
+ getCacheStats(): {
837
+ size: number;
838
+ hits: number;
839
+ misses: number;
840
+ hitRate: number;
841
+ };
842
+ getCloudURL(): string;
843
+ setTokens(accessToken: string, refreshToken?: string): void;
844
+ clearTokens(): void;
845
+ getCurrentUserId(): string | null;
846
+ hasValidToken(): boolean;
847
+ getAccessToken(): string | null;
848
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
849
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
850
+ hasAccessToken(): boolean;
851
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
852
+ maxRetries?: number;
853
+ retryDelay?: number;
854
+ authTimeoutMs?: number;
855
+ }): Promise<T>;
856
+ validate(): Promise<boolean>;
857
+ handleError(error: any): Error;
858
+ healthCheck(): Promise<{
859
+ status: string;
860
+ users?: number;
861
+ timestamp?: string;
862
+ [key: string]: any;
863
+ }>;
864
+ };
865
+ __resetTokensForTests(): void;
866
+ } & {
867
+ new (...args: any[]): {
868
+ signUp(username: string, email: string, password: string): Promise<{
869
+ message: string;
870
+ token: string;
871
+ user: import(".").User;
872
+ }>;
873
+ requestRecovery(identifier: string): Promise<{
874
+ delivery?: string;
875
+ destination?: string;
876
+ }>;
877
+ verifyRecoveryCode(identifier: string, code: string): Promise<{
878
+ verified: boolean;
879
+ }>;
880
+ resetPassword(identifier: string, code: string, newPassword: string): Promise<{
881
+ success: boolean;
882
+ }>;
883
+ resetPasswordWithTotp(identifier: string, code: string, newPassword: string): Promise<{
884
+ success: boolean;
885
+ }>;
886
+ resetPasswordWithBackupCode(identifier: string, backupCode: string, newPassword: string): Promise<{
887
+ success: boolean;
888
+ }>;
889
+ resetPasswordWithRecoveryKey(identifier: string, recoveryKey: string, newPassword: string): Promise<{
890
+ success: boolean;
891
+ nextRecoveryKey?: string;
892
+ }>;
893
+ signIn(username: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<import(".").SessionLoginResponse | {
894
+ mfaRequired: true;
895
+ mfaToken: string;
896
+ expiresAt: string;
897
+ }>;
898
+ verifyTotpLogin(mfaToken: string, code: string): Promise<import(".").SessionLoginResponse>;
899
+ getUserBySession(sessionId: string): Promise<import(".").User>;
900
+ getUsersBySessions(sessionIds: string[]): Promise<{
901
+ sessionId: string;
902
+ user: import(".").User | null;
903
+ }[]>;
904
+ getTokenBySession(sessionId: string): Promise<{
905
+ accessToken: string;
906
+ expiresAt: string;
907
+ }>;
908
+ getSessionsBySessionId(sessionId: string): Promise<any[]>;
909
+ logoutSession(sessionId: string, targetSessionId?: string): Promise<void>;
910
+ logoutAllSessions(sessionId: string): Promise<void>;
911
+ validateSession(sessionId: string, options?: {
912
+ deviceFingerprint?: string;
913
+ useHeaderValidation?: boolean;
914
+ }): Promise<{
915
+ valid: boolean;
916
+ expiresAt: string;
917
+ lastActivity: string;
918
+ user: import(".").User;
919
+ sessionId?: string;
920
+ source?: string;
921
+ }>;
922
+ checkUsernameAvailability(username: string): Promise<{
923
+ available: boolean;
924
+ message: string;
925
+ }>;
926
+ checkEmailAvailability(email: string): Promise<{
927
+ available: boolean;
928
+ message: string;
929
+ }>;
930
+ httpClient: import("./HttpClient").HttpClient;
931
+ requestManager: import("./RequestManager").RequestManager;
932
+ cloudURL: string;
933
+ config: OxyConfig;
934
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("./RequestManager").RequestOptions): Promise<T>;
935
+ getBaseURL(): string;
936
+ getClient(): import("./HttpClient").HttpClient;
937
+ getMetrics(): {
938
+ totalRequests: number;
939
+ successfulRequests: number;
940
+ failedRequests: number;
941
+ cacheHits: number;
942
+ cacheMisses: number;
943
+ averageResponseTime: number;
944
+ };
945
+ clearCache(): void;
946
+ clearCacheEntry(key: string): void;
947
+ getCacheStats(): {
948
+ size: number;
949
+ hits: number;
950
+ misses: number;
951
+ hitRate: number;
952
+ };
953
+ getCloudURL(): string;
954
+ setTokens(accessToken: string, refreshToken?: string): void;
955
+ clearTokens(): void;
956
+ getCurrentUserId(): string | null;
957
+ hasValidToken(): boolean;
958
+ getAccessToken(): string | null;
959
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
960
+ waitForAuthentication(timeoutMs?: number): Promise<boolean>;
961
+ hasAccessToken(): boolean;
962
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
963
+ maxRetries?: number;
964
+ retryDelay?: number;
965
+ authTimeoutMs?: number;
966
+ }): Promise<T>;
967
+ validate(): Promise<boolean>;
968
+ handleError(error: any): Error;
969
+ healthCheck(): Promise<{
970
+ status: string;
971
+ users?: number;
972
+ timestamp?: string;
973
+ [key: string]: any;
974
+ }>;
975
+ };
976
+ __resetTokensForTests(): void;
977
+ } & typeof OxyServicesBase;
978
+ export declare class OxyServices extends OxyServicesComposed {
979
+ constructor(config: OxyConfig);
694
980
  }
981
+ export { OxyAuthenticationError, OxyAuthenticationTimeoutError };
695
982
  /**
696
983
  * Export the default Oxy Cloud URL (for backward compatibility)
697
984
  */