@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
@@ -0,0 +1,303 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesAuthMixin = OxyServicesAuthMixin;
7
+ var _OxyServices = require("../OxyServices.errors");
8
+ /**
9
+ * Authentication Methods Mixin
10
+ */
11
+
12
+ function OxyServicesAuthMixin(Base) {
13
+ return class extends Base {
14
+ constructor(...args) {
15
+ super(...args);
16
+ }
17
+ /**
18
+ * Sign up a new user
19
+ */
20
+ async signUp(username, email, password) {
21
+ try {
22
+ const res = await this.makeRequest('POST', '/api/auth/signup', {
23
+ username,
24
+ email,
25
+ password
26
+ }, {
27
+ cache: false
28
+ });
29
+ if (!res || typeof res === 'object' && Object.keys(res).length === 0) {
30
+ throw new _OxyServices.OxyAuthenticationError('Sign up failed', 'SIGNUP_FAILED', 400);
31
+ }
32
+ return res;
33
+ } catch (error) {
34
+ throw this.handleError(error);
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Request account recovery (send verification code)
40
+ */
41
+ async requestRecovery(identifier) {
42
+ try {
43
+ return await this.makeRequest('POST', '/api/auth/recover/request', {
44
+ identifier
45
+ }, {
46
+ cache: false
47
+ });
48
+ } catch (error) {
49
+ throw this.handleError(error);
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Verify recovery code
55
+ */
56
+ async verifyRecoveryCode(identifier, code) {
57
+ try {
58
+ return await this.makeRequest('POST', '/api/auth/recover/verify', {
59
+ identifier,
60
+ code
61
+ }, {
62
+ cache: false
63
+ });
64
+ } catch (error) {
65
+ throw this.handleError(error);
66
+ }
67
+ }
68
+
69
+ /**
70
+ * Reset password using verified code
71
+ */
72
+ async resetPassword(identifier, code, newPassword) {
73
+ try {
74
+ return await this.makeRequest('POST', '/api/auth/recover/reset', {
75
+ identifier,
76
+ code,
77
+ newPassword
78
+ }, {
79
+ cache: false
80
+ });
81
+ } catch (error) {
82
+ throw this.handleError(error);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Reset password using TOTP code (recommended recovery)
88
+ */
89
+ async resetPasswordWithTotp(identifier, code, newPassword) {
90
+ try {
91
+ return await this.makeRequest('POST', '/api/auth/recover/totp/reset', {
92
+ identifier,
93
+ code,
94
+ newPassword
95
+ }, {
96
+ cache: false
97
+ });
98
+ } catch (error) {
99
+ throw this.handleError(error);
100
+ }
101
+ }
102
+ async resetPasswordWithBackupCode(identifier, backupCode, newPassword) {
103
+ try {
104
+ return await this.makeRequest('POST', '/api/auth/recover/backup/reset', {
105
+ identifier,
106
+ backupCode,
107
+ newPassword
108
+ }, {
109
+ cache: false
110
+ });
111
+ } catch (error) {
112
+ throw this.handleError(error);
113
+ }
114
+ }
115
+ async resetPasswordWithRecoveryKey(identifier, recoveryKey, newPassword) {
116
+ try {
117
+ return await this.makeRequest('POST', '/api/auth/recover/recovery-key/reset', {
118
+ identifier,
119
+ recoveryKey,
120
+ newPassword
121
+ }, {
122
+ cache: false
123
+ });
124
+ } catch (error) {
125
+ throw this.handleError(error);
126
+ }
127
+ }
128
+
129
+ /**
130
+ * Sign in with device management
131
+ */
132
+ async signIn(username, password, deviceName, deviceFingerprint) {
133
+ try {
134
+ return await this.makeRequest('POST', '/api/auth/login', {
135
+ username,
136
+ password,
137
+ deviceName,
138
+ deviceFingerprint
139
+ }, {
140
+ cache: false
141
+ });
142
+ } catch (error) {
143
+ throw this.handleError(error);
144
+ }
145
+ }
146
+
147
+ /**
148
+ * Complete login by verifying TOTP with MFA token
149
+ */
150
+ async verifyTotpLogin(mfaToken, code) {
151
+ try {
152
+ return await this.makeRequest('POST', '/api/auth/totp/verify-login', {
153
+ mfaToken,
154
+ code
155
+ }, {
156
+ cache: false
157
+ });
158
+ } catch (error) {
159
+ throw this.handleError(error);
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Get user by session ID
165
+ */
166
+ async getUserBySession(sessionId) {
167
+ try {
168
+ return await this.makeRequest('GET', `/api/session/user/${sessionId}`, undefined, {
169
+ cache: true,
170
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache for user data
171
+ });
172
+ } catch (error) {
173
+ throw this.handleError(error);
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Batch get multiple user profiles by session IDs (optimized for account switching)
179
+ * Returns array of { sessionId, user } objects
180
+ */
181
+ async getUsersBySessions(sessionIds) {
182
+ try {
183
+ if (!Array.isArray(sessionIds) || sessionIds.length === 0) {
184
+ return [];
185
+ }
186
+
187
+ // Deduplicate and sort sessionIds for consistent cache keys
188
+ const uniqueSessionIds = Array.from(new Set(sessionIds)).sort();
189
+ return await this.makeRequest('POST', '/api/session/users/batch', {
190
+ sessionIds: uniqueSessionIds
191
+ }, {
192
+ cache: true,
193
+ cacheTTL: 2 * 60 * 1000,
194
+ // 2 minutes cache
195
+ deduplicate: true // Important for batch requests
196
+ });
197
+ } catch (error) {
198
+ throw this.handleError(error);
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Get access token by session ID and set it in the token store
204
+ */
205
+ async getTokenBySession(sessionId) {
206
+ try {
207
+ const res = await this.makeRequest('GET', `/api/session/token/${sessionId}`, undefined, {
208
+ cache: false,
209
+ retry: false
210
+ });
211
+
212
+ // Set the token in the centralized token store
213
+ this.setTokens(res.accessToken);
214
+ return res;
215
+ } catch (error) {
216
+ throw this.handleError(error);
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Get sessions by session ID
222
+ */
223
+ async getSessionsBySessionId(sessionId) {
224
+ try {
225
+ return await this.makeRequest('GET', `/api/session/sessions/${sessionId}`, undefined, {
226
+ cache: false
227
+ });
228
+ } catch (error) {
229
+ throw this.handleError(error);
230
+ }
231
+ }
232
+
233
+ /**
234
+ * Logout from a specific session
235
+ */
236
+ async logoutSession(sessionId, targetSessionId) {
237
+ try {
238
+ const url = targetSessionId ? `/api/session/logout/${sessionId}/${targetSessionId}` : `/api/session/logout/${sessionId}`;
239
+ await this.makeRequest('POST', url, undefined, {
240
+ cache: false
241
+ });
242
+ } catch (error) {
243
+ throw this.handleError(error);
244
+ }
245
+ }
246
+
247
+ /**
248
+ * Logout from all sessions
249
+ */
250
+ async logoutAllSessions(sessionId) {
251
+ try {
252
+ await this.makeRequest('POST', `/api/session/logout-all/${sessionId}`, undefined, {
253
+ cache: false
254
+ });
255
+ } catch (error) {
256
+ throw this.handleError(error);
257
+ }
258
+ }
259
+
260
+ /**
261
+ * Validate session
262
+ */
263
+ async validateSession(sessionId, options = {}) {
264
+ try {
265
+ const urlParams = {};
266
+ if (options.deviceFingerprint) urlParams.deviceFingerprint = options.deviceFingerprint;
267
+ if (options.useHeaderValidation) urlParams.useHeaderValidation = 'true';
268
+ return await this.makeRequest('GET', `/api/session/validate/${sessionId}`, urlParams, {
269
+ cache: false
270
+ });
271
+ } catch (error) {
272
+ throw this.handleError(error);
273
+ }
274
+ }
275
+
276
+ /**
277
+ * Check username availability
278
+ */
279
+ async checkUsernameAvailability(username) {
280
+ try {
281
+ return await this.makeRequest('GET', `/api/auth/check-username/${username}`, undefined, {
282
+ cache: false
283
+ });
284
+ } catch (error) {
285
+ throw this.handleError(error);
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Check email availability
291
+ */
292
+ async checkEmailAvailability(email) {
293
+ try {
294
+ return await this.makeRequest('GET', `/api/auth/check-email/${email}`, undefined, {
295
+ cache: false
296
+ });
297
+ } catch (error) {
298
+ throw this.handleError(error);
299
+ }
300
+ }
301
+ };
302
+ }
303
+ //# sourceMappingURL=OxyServices.auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_OxyServices","require","OxyServicesAuthMixin","Base","constructor","args","signUp","username","email","password","res","makeRequest","cache","Object","keys","length","OxyAuthenticationError","error","handleError","requestRecovery","identifier","verifyRecoveryCode","code","resetPassword","newPassword","resetPasswordWithTotp","resetPasswordWithBackupCode","backupCode","resetPasswordWithRecoveryKey","recoveryKey","signIn","deviceName","deviceFingerprint","verifyTotpLogin","mfaToken","getUserBySession","sessionId","undefined","cacheTTL","getUsersBySessions","sessionIds","Array","isArray","uniqueSessionIds","from","Set","sort","deduplicate","getTokenBySession","retry","setTokens","accessToken","getSessionsBySessionId","logoutSession","targetSessionId","url","logoutAllSessions","validateSession","options","urlParams","useHeaderValidation","checkUsernameAvailability","checkEmailAvailability"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.auth.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AANA;AACA;AACA;;AAMO,SAASC,oBAAoBA,CAAmCC,IAAO,EAAE;EAC9E,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,MAAMA,CAACC,QAAgB,EAAEC,KAAa,EAAEC,QAAgB,EAA2D;MACvH,IAAI;QACF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,WAAW,CAAiD,MAAM,EAAE,kBAAkB,EAAE;UAC7GJ,QAAQ;UACRC,KAAK;UACLC;QACF,CAAC,EAAE;UAAEG,KAAK,EAAE;QAAM,CAAC,CAAC;QACpB,IAAI,CAACF,GAAG,IAAK,OAAOA,GAAG,KAAK,QAAQ,IAAIG,MAAM,CAACC,IAAI,CAACJ,GAAG,CAAC,CAACK,MAAM,KAAK,CAAE,EAAE;UACtE,MAAM,IAAIC,mCAAsB,CAAC,gBAAgB,EAAE,eAAe,EAAE,GAAG,CAAC;QAC1E;QACA,OAAON,GAAG;MACZ,CAAC,CAAC,OAAOO,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;IACI,MAAME,eAAeA,CAACC,UAAkB,EAAwD;MAC9F,IAAI;QACF,OAAO,MAAM,IAAI,CAACT,WAAW,CAAC,MAAM,EAAE,2BAA2B,EAAE;UAAES;QAAW,CAAC,EAAE;UAAER,KAAK,EAAE;QAAM,CAAC,CAAC;MACtG,CAAC,CAAC,OAAOK,KAAU,EAAE;Q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use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesDeveloperMixin = OxyServicesDeveloperMixin;
7
+ var _mixinHelpers = require("./mixinHelpers");
8
+ /**
9
+ * Developer API Methods Mixin
10
+ *
11
+ * Provides methods for managing developer applications and API keys
12
+ */
13
+
14
+ function OxyServicesDeveloperMixin(Base) {
15
+ return class extends Base {
16
+ constructor(...args) {
17
+ super(...args);
18
+ }
19
+
20
+ /**
21
+ * Get developer apps for the current user
22
+ * @returns Array of developer apps
23
+ */
24
+ async getDeveloperApps() {
25
+ try {
26
+ const res = await this.makeRequest('GET', '/api/developer/apps', undefined, {
27
+ cache: true,
28
+ cacheTTL: _mixinHelpers.CACHE_TIMES.MEDIUM
29
+ });
30
+ return res.apps || [];
31
+ } catch (error) {
32
+ throw this.handleError(error);
33
+ }
34
+ }
35
+
36
+ /**
37
+ * Create a new developer app
38
+ * @param data - Developer app configuration
39
+ * @returns Created developer app
40
+ */
41
+ async createDeveloperApp(data) {
42
+ try {
43
+ const res = await this.makeRequest('POST', '/api/developer/apps', data, {
44
+ cache: false
45
+ });
46
+ return res.app;
47
+ } catch (error) {
48
+ throw this.handleError(error);
49
+ }
50
+ }
51
+
52
+ /**
53
+ * Get a specific developer app
54
+ */
55
+ async getDeveloperApp(appId) {
56
+ try {
57
+ const res = await this.makeRequest('GET', `/api/developer/apps/${appId}`, undefined, {
58
+ cache: true,
59
+ cacheTTL: _mixinHelpers.CACHE_TIMES.LONG
60
+ });
61
+ return res.app;
62
+ } catch (error) {
63
+ throw this.handleError(error);
64
+ }
65
+ }
66
+
67
+ /**
68
+ * Update a developer app
69
+ * @param appId - The developer app ID
70
+ * @param data - Updated app configuration
71
+ * @returns Updated developer app
72
+ */
73
+ async updateDeveloperApp(appId, data) {
74
+ try {
75
+ const res = await this.makeRequest('PATCH', `/api/developer/apps/${appId}`, data, {
76
+ cache: false
77
+ });
78
+ return res.app;
79
+ } catch (error) {
80
+ throw this.handleError(error);
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Regenerate API secret for a developer app
86
+ * @param appId - The developer app ID
87
+ * @returns App with new secret
88
+ */
89
+ async regenerateDeveloperAppSecret(appId) {
90
+ try {
91
+ return await this.makeRequest('POST', `/api/developer/apps/${appId}/regenerate-secret`, undefined, {
92
+ cache: false
93
+ });
94
+ } catch (error) {
95
+ throw this.handleError(error);
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Delete a developer app
101
+ * @param appId - The developer app ID
102
+ * @returns Deletion result
103
+ */
104
+ async deleteDeveloperApp(appId) {
105
+ try {
106
+ return await this.makeRequest('DELETE', `/api/developer/apps/${appId}`, undefined, {
107
+ cache: false
108
+ });
109
+ } catch (error) {
110
+ throw this.handleError(error);
111
+ }
112
+ }
113
+ };
114
+ }
115
+ //# sourceMappingURL=OxyServices.developer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_mixinHelpers","require","OxyServicesDeveloperMixin","Base","constructor","args","getDeveloperApps","res","makeRequest","undefined","cache","cacheTTL","CACHE_TIMES","MEDIUM","apps","error","handleError","createDeveloperApp","data","app","getDeveloperApp","appId","LONG","updateDeveloperApp","regenerateDeveloperAppSecret","deleteDeveloperApp"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.developer.ts"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAIO,SAASC,yBAAyBA,CAAmCC,IAAO,EAAE;EACnF,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;;IAEA;AACJ;AACA;AACA;IACI,MAAMC,gBAAgBA,CAAA,EAAmB;MACvC,IAAI;QACF,MAAMC,GAAG,GAAG,MAAM,IAAI,CAACC,WAAW,CAAmB,KAAK,EAAE,qBAAqB,EAAEC,SAAS,EAAE;UAC5FC,KAAK,EAAE,IAAI;UACXC,QA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AACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;AACA;AACA;IACI,MAAMS,4BAA4BA,CAACH,KAAa,EAAgB;MAC9D,IAAI;QACF,OAAO,MAAM,IAAI,CAACb,WAAW,CAAC,MAAM,EAAE,uBAAuBa,KAAK,oBAAoB,EAAEZ,SAAS,EAAE;UAAEC,KAAK,EAAE;QAAM,CAAC,CAAC;MACtH,CAAC,CAAC,OAAOK,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;AACA;AACA;IACI,MAAMU,kBAAkBA,CAACJ,KAAa,EAAgB;MACpD,IAAI;QACF,OAAO,MAAM,IAAI,CAACb,WAAW,CAAC,QAAQ,EAAE,uBAAuBa,KAAK,EAAE,EAAEZ,SAAS,EAAE;UAAEC,KAAK,EAAE;QAAM,CAAC,CAAC;MACtG,CAAC,CAAC,OAAOK,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesDevicesMixin = OxyServicesDevicesMixin;
7
+ /**
8
+ * Device Methods Mixin
9
+ */
10
+
11
+ function OxyServicesDevicesMixin(Base) {
12
+ return class extends Base {
13
+ constructor(...args) {
14
+ super(...args);
15
+ }
16
+
17
+ /**
18
+ * Register a new device
19
+ * @param deviceData - Device information
20
+ * @returns Registered device object
21
+ */
22
+ async registerDevice(deviceData) {
23
+ try {
24
+ return await this.makeRequest('POST', '/api/devices', deviceData, {
25
+ cache: false
26
+ });
27
+ } catch (error) {
28
+ throw this.handleError(error);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Get all devices for the current user
34
+ * @returns Array of user devices
35
+ */
36
+ async getUserDevices() {
37
+ try {
38
+ return await this.makeRequest('GET', '/api/devices', undefined, {
39
+ cache: false // Don't cache device list - always get fresh data
40
+ });
41
+ } catch (error) {
42
+ throw this.handleError(error);
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Remove a device
48
+ * @param deviceId - The device ID to remove
49
+ */
50
+ async removeDevice(deviceId) {
51
+ try {
52
+ await this.makeRequest('DELETE', `/api/devices/${deviceId}`, undefined, {
53
+ cache: false
54
+ });
55
+ } catch (error) {
56
+ throw this.handleError(error);
57
+ }
58
+ }
59
+
60
+ /**
61
+ * Get device sessions for a given session ID
62
+ * Note: Not cached by default to ensure fresh data
63
+ * @param sessionId - The session ID
64
+ * @returns Array of device sessions
65
+ */
66
+ async getDeviceSessions(sessionId) {
67
+ try {
68
+ // Use makeRequest for consistent error handling and optional caching
69
+ // Cache disabled by default to ensure fresh session data
70
+ return await this.makeRequest('GET', `/api/session/device/sessions/${sessionId}`, undefined, {
71
+ cache: false,
72
+ // Don't cache sessions - always get fresh data
73
+ deduplicate: true // Deduplicate concurrent requests for same sessionId
74
+ });
75
+ } catch (error) {
76
+ throw this.handleError(error);
77
+ }
78
+ }
79
+
80
+ /**
81
+ * Logout all device sessions
82
+ * @param sessionId - The session ID
83
+ * @param deviceId - Optional device ID to target
84
+ * @param excludeCurrent - Whether to exclude the current session
85
+ * @returns Logout result
86
+ */
87
+ async logoutAllDeviceSessions(sessionId, deviceId, excludeCurrent) {
88
+ try {
89
+ const urlParams = {};
90
+ if (deviceId) urlParams.deviceId = deviceId;
91
+ if (excludeCurrent) urlParams.excludeCurrent = 'true';
92
+ return await this.makeRequest('POST', `/api/session/device/logout-all/${sessionId}`, urlParams, {
93
+ cache: false
94
+ });
95
+ } catch (error) {
96
+ throw this.handleError(error);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * Update device name
102
+ * @param sessionId - The session ID
103
+ * @param deviceName - New device name
104
+ * @returns Updated device object
105
+ */
106
+ async updateDeviceName(sessionId, deviceName) {
107
+ try {
108
+ return await this.makeRequest('PUT', `/api/session/device/name/${sessionId}`, {
109
+ deviceName
110
+ }, {
111
+ cache: false
112
+ });
113
+ } catch (error) {
114
+ throw this.handleError(error);
115
+ }
116
+ }
117
+ };
118
+ }
119
+ //# sourceMappingURL=OxyServices.devices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["OxyServicesDevicesMixin","Base","constructor","args","registerDevice","deviceData","makeRequest","cache","error","handleError","getUserDevices","undefined","removeDevice","deviceId","getDeviceSessions","sessionId","deduplicate","logoutAllDeviceSessions","excludeCurrent","urlParams","updateDeviceName","deviceName"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.devices.ts"],"mappings":";;;;;;AAAA;AACA;AACA;;AAGO,SAASA,uBAAuBA,CAAmCC,IAAO,EAAE;EACjF,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;;IAEA;AACJ;AACA;AACA;AACA;IACI,MAAMC,cAAcA,CAACC,UAAe,EAAgB;MAClD,IAAI;QACF,OAAO,MAAM,IAAI,CAACC,WAAW,CAAC,MAAM,EAAE,cAAc,EAAED,UAAU,EAAE;UAAEE,KAAK,EAAE;QAAM,CAAC,CAAC;MACrF,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;AACA;IACI,MAAME,cAAcA,CAAA,EAAmB;MACrC,IAAI;QACF,OAAO,MAAM,IAAI,CAACJ,WAAW,CAAC,KAAK,EAAE,cAAc,EAAEK,SAAS,EAAE;UAC9DJ,KAAK,EAAE,KAAK,CAAE;QAChB,CAAC,CAAC;MACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;;IAEA;AACJ;AACA;AACA;IACI,MAAMI,YAAYA,CAACC,QAAgB,EAAiB;MAClD,IAA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AACf,WAAW,CAAC,KAAK,EAAE,4BAA4BS,SAAS,EAAE,EAAE;UAAEM;QAAW,CAAC,EAAE;UAAEd,KAAK,EAAE;QAAM,CAAC,CAAC;MACjH,CAAC,CAAC,OAAOC,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyServicesKarmaMixin = OxyServicesKarmaMixin;
7
+ var _mixinHelpers = require("./mixinHelpers");
8
+ /**
9
+ * Karma Methods Mixin
10
+ *
11
+ * Provides methods for karma system management
12
+ */
13
+
14
+ function OxyServicesKarmaMixin(Base) {
15
+ return class extends Base {
16
+ constructor(...args) {
17
+ super(...args);
18
+ }
19
+ /**
20
+ * Get user karma
21
+ */
22
+ async getUserKarma(userId) {
23
+ try {
24
+ return await this.makeRequest('GET', `/api/karma/${userId}`, undefined, {
25
+ cache: true,
26
+ cacheTTL: 2 * 60 * 1000 // 2 minutes cache
27
+ });
28
+ } catch (error) {
29
+ throw this.handleError(error);
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Give karma to user
35
+ */
36
+ async giveKarma(userId, amount, reason) {
37
+ try {
38
+ return await this.makeRequest('POST', `/api/karma/${userId}/give`, {
39
+ amount,
40
+ reason
41
+ }, {
42
+ cache: false
43
+ });
44
+ } catch (error) {
45
+ throw this.handleError(error);
46
+ }
47
+ }
48
+
49
+ /**
50
+ * Get user karma total
51
+ * @param userId - The user ID
52
+ * @returns User karma total
53
+ */
54
+ async getUserKarmaTotal(userId) {
55
+ try {
56
+ return await this.makeRequest('GET', `/api/karma/${userId}/total`, undefined, {
57
+ cache: true,
58
+ cacheTTL: _mixinHelpers.CACHE_TIMES.MEDIUM
59
+ });
60
+ } catch (error) {
61
+ throw this.handleError(error);
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Get user karma history
67
+ * @param userId - The user ID
68
+ * @param limit - Optional limit for results
69
+ * @param offset - Optional offset for pagination
70
+ * @returns User karma history
71
+ */
72
+ async getUserKarmaHistory(userId, limit, offset) {
73
+ try {
74
+ const params = {};
75
+ if (limit) params.limit = limit;
76
+ if (offset) params.offset = offset;
77
+ return await this.makeRequest('GET', `/api/karma/${userId}/history`, params, {
78
+ cache: true,
79
+ cacheTTL: _mixinHelpers.CACHE_TIMES.MEDIUM
80
+ });
81
+ } catch (error) {
82
+ throw this.handleError(error);
83
+ }
84
+ }
85
+
86
+ /**
87
+ * Get karma leaderboard
88
+ * @returns Karma leaderboard
89
+ */
90
+ async getKarmaLeaderboard() {
91
+ try {
92
+ return await this.makeRequest('GET', '/api/karma/leaderboard', undefined, {
93
+ cache: true,
94
+ cacheTTL: _mixinHelpers.CACHE_TIMES.LONG
95
+ });
96
+ } catch (error) {
97
+ throw this.handleError(error);
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Get karma rules
103
+ * @returns Karma rules
104
+ */
105
+ async getKarmaRules() {
106
+ try {
107
+ return await this.makeRequest('GET', '/api/karma/rules', undefined, {
108
+ cache: true,
109
+ cacheTTL: _mixinHelpers.CACHE_TIMES.EXTRA_LONG // Rules don't change often
110
+ });
111
+ } catch (error) {
112
+ throw this.handleError(error);
113
+ }
114
+ }
115
+ };
116
+ }
117
+ //# sourceMappingURL=OxyServices.karma.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_mixinHelpers","require","OxyServicesKarmaMixin","Base","constructor","args","getUserKarma","userId","makeRequest","undefined","cache","cacheTTL","error","handleError","giveKarma","amount","reason","getUserKarmaTotal","CACHE_TIMES","MEDIUM","getUserKarmaHistory","limit","offset","params","getKarmaLeaderboard","LONG","getKarmaRules","EXTRA_LONG"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.karma.ts"],"mappings":";;;;;;AAMA,IAAAA,aAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAIO,SA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