@oxyhq/services 5.13.15 → 5.13.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -0
- package/lib/commonjs/core/OxyServices.base.js +271 -0
- package/lib/commonjs/core/OxyServices.base.js.map +1 -0
- package/lib/commonjs/core/OxyServices.errors.js +26 -0
- package/lib/commonjs/core/OxyServices.errors.js.map +1 -0
- package/lib/commonjs/core/OxyServices.js +58 -2168
- package/lib/commonjs/core/OxyServices.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.analytics.js +60 -0
- package/lib/commonjs/core/mixins/OxyServices.analytics.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.assets.js +424 -0
- package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.auth.js +303 -0
- package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.developer.js +115 -0
- package/lib/commonjs/core/mixins/OxyServices.developer.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.devices.js +119 -0
- package/lib/commonjs/core/mixins/OxyServices.devices.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.karma.js +117 -0
- package/lib/commonjs/core/mixins/OxyServices.karma.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.language.js +124 -0
- package/lib/commonjs/core/mixins/OxyServices.language.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.location.js +55 -0
- package/lib/commonjs/core/mixins/OxyServices.location.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.payment.js +66 -0
- package/lib/commonjs/core/mixins/OxyServices.payment.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.privacy.js +174 -0
- package/lib/commonjs/core/mixins/OxyServices.privacy.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.totp.js +53 -0
- package/lib/commonjs/core/mixins/OxyServices.totp.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js +388 -0
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -0
- package/lib/commonjs/core/mixins/OxyServices.utility.js +161 -0
- package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -0
- package/lib/commonjs/core/mixins/index.js +39 -0
- package/lib/commonjs/core/mixins/index.js.map +1 -0
- package/lib/commonjs/core/mixins/mixinHelpers.js +62 -0
- package/lib/commonjs/core/mixins/mixinHelpers.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js +27 -2
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/module/core/OxyServices.base.js +265 -0
- package/lib/module/core/OxyServices.base.js.map +1 -0
- package/lib/module/core/OxyServices.errors.js +20 -0
- package/lib/module/core/OxyServices.errors.js.map +1 -0
- package/lib/module/core/OxyServices.js +43 -2164
- package/lib/module/core/OxyServices.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.analytics.js +56 -0
- package/lib/module/core/mixins/OxyServices.analytics.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.assets.js +420 -0
- package/lib/module/core/mixins/OxyServices.assets.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.auth.js +299 -0
- package/lib/module/core/mixins/OxyServices.auth.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.developer.js +111 -0
- package/lib/module/core/mixins/OxyServices.developer.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.devices.js +115 -0
- package/lib/module/core/mixins/OxyServices.devices.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.karma.js +113 -0
- package/lib/module/core/mixins/OxyServices.karma.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.language.js +120 -0
- package/lib/module/core/mixins/OxyServices.language.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.location.js +51 -0
- package/lib/module/core/mixins/OxyServices.location.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.payment.js +62 -0
- package/lib/module/core/mixins/OxyServices.payment.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.privacy.js +170 -0
- package/lib/module/core/mixins/OxyServices.privacy.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.totp.js +49 -0
- package/lib/module/core/mixins/OxyServices.totp.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.user.js +384 -0
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -0
- package/lib/module/core/mixins/OxyServices.utility.js +156 -0
- package/lib/module/core/mixins/OxyServices.utility.js.map +1 -0
- package/lib/module/core/mixins/index.js +36 -0
- package/lib/module/core/mixins/index.js.map +1 -0
- package/lib/module/core/mixins/mixinHelpers.js +56 -0
- package/lib/module/core/mixins/mixinHelpers.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js +27 -2
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/typescript/core/OxyServices.base.d.ts +123 -0
- package/lib/typescript/core/OxyServices.base.d.ts.map +1 -0
- package/lib/typescript/core/OxyServices.d.ts +970 -746
- package/lib/typescript/core/OxyServices.d.ts.map +1 -1
- package/lib/typescript/core/OxyServices.errors.d.ts +12 -0
- package/lib/typescript/core/OxyServices.errors.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts +70 -0
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts +166 -0
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +168 -0
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts +103 -0
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts +93 -0
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts +89 -0
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.language.d.ts +85 -0
- package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.location.d.ts +68 -0
- package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts +74 -0
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts +126 -0
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts +69 -0
- package/lib/typescript/core/mixins/OxyServices.totp.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +189 -0
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -0
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts +97 -0
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -0
- package/lib/typescript/core/mixins/index.d.ts +899 -0
- package/lib/typescript/core/mixins/index.d.ts.map +1 -0
- package/lib/typescript/core/mixins/mixinHelpers.d.ts +32 -0
- package/lib/typescript/core/mixins/mixinHelpers.d.ts.map +1 -0
- package/lib/typescript/models/interfaces.d.ts +10 -0
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/ui/context/OxyContext.d.ts +2 -0
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/core/OxyServices.base.ts +311 -0
- package/src/core/OxyServices.errors.ts +26 -0
- package/src/core/OxyServices.ts +43 -2199
- package/src/core/mixins/OxyServices.analytics.ts +53 -0
- package/src/core/mixins/OxyServices.assets.ts +410 -0
- package/src/core/mixins/OxyServices.auth.ts +275 -0
- package/src/core/mixins/OxyServices.developer.ts +114 -0
- package/src/core/mixins/OxyServices.devices.ts +103 -0
- package/src/core/mixins/OxyServices.karma.ts +111 -0
- package/src/core/mixins/OxyServices.language.ts +127 -0
- package/src/core/mixins/OxyServices.location.ts +46 -0
- package/src/core/mixins/OxyServices.payment.ts +59 -0
- package/src/core/mixins/OxyServices.privacy.ts +182 -0
- package/src/core/mixins/OxyServices.totp.ts +36 -0
- package/src/core/mixins/OxyServices.user.ts +384 -0
- package/src/core/mixins/OxyServices.utility.ts +187 -0
- package/src/core/mixins/index.ts +58 -0
- package/src/core/mixins/mixinHelpers.ts +69 -0
- package/src/models/interfaces.ts +12 -0
- package/src/ui/context/OxyContext.tsx +36 -0
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OxyServicesUserMixin = OxyServicesUserMixin;
|
|
7
|
+
var _apiUtils = require("../../utils/apiUtils");
|
|
8
|
+
/**
|
|
9
|
+
* User Management Methods Mixin
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
function OxyServicesUserMixin(Base) {
|
|
13
|
+
return class extends Base {
|
|
14
|
+
constructor(...args) {
|
|
15
|
+
super(...args);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get profile by username
|
|
19
|
+
*/
|
|
20
|
+
async getProfileByUsername(username) {
|
|
21
|
+
try {
|
|
22
|
+
return await this.makeRequest('GET', `/api/profiles/username/${username}`, undefined, {
|
|
23
|
+
cache: true,
|
|
24
|
+
cacheTTL: 5 * 60 * 1000 // 5 minutes cache for profiles
|
|
25
|
+
});
|
|
26
|
+
} catch (error) {
|
|
27
|
+
throw this.handleError(error);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Search user profiles
|
|
33
|
+
*/
|
|
34
|
+
async searchProfiles(query, pagination) {
|
|
35
|
+
try {
|
|
36
|
+
const params = {
|
|
37
|
+
query,
|
|
38
|
+
...pagination
|
|
39
|
+
};
|
|
40
|
+
const searchParams = (0, _apiUtils.buildSearchParams)(params);
|
|
41
|
+
const paramsObj = Object.fromEntries(searchParams.entries());
|
|
42
|
+
const response = await this.makeRequest('GET', '/api/profiles/search', paramsObj, {
|
|
43
|
+
cache: true,
|
|
44
|
+
cacheTTL: 2 * 60 * 1000 // 2 minutes cache
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// New API shape: { data: User[], pagination: {...} }
|
|
48
|
+
const isSearchProfilesResponse = payload => typeof payload === 'object' && payload !== null && Array.isArray(payload.data);
|
|
49
|
+
if (isSearchProfilesResponse(response)) {
|
|
50
|
+
const typedResponse = response;
|
|
51
|
+
const paginationInfo = typedResponse.pagination ?? {
|
|
52
|
+
total: typedResponse.data.length,
|
|
53
|
+
limit: pagination?.limit ?? typedResponse.data.length,
|
|
54
|
+
offset: pagination?.offset ?? 0,
|
|
55
|
+
hasMore: typedResponse.data.length === (pagination?.limit ?? typedResponse.data.length) && (pagination?.limit ?? typedResponse.data.length) > 0
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
data: typedResponse.data,
|
|
59
|
+
pagination: paginationInfo
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Legacy API shape: returns raw User[]
|
|
64
|
+
if (Array.isArray(response)) {
|
|
65
|
+
const fallbackLimit = pagination?.limit ?? response.length;
|
|
66
|
+
const fallbackPagination = {
|
|
67
|
+
total: response.length,
|
|
68
|
+
limit: fallbackLimit,
|
|
69
|
+
offset: pagination?.offset ?? 0,
|
|
70
|
+
hasMore: fallbackLimit > 0 && response.length === fallbackLimit
|
|
71
|
+
};
|
|
72
|
+
return {
|
|
73
|
+
data: response,
|
|
74
|
+
pagination: fallbackPagination
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// If response is unexpected, throw an error
|
|
79
|
+
throw new Error('Unexpected search response format');
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw this.handleError(error);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Get profile recommendations
|
|
87
|
+
*/
|
|
88
|
+
async getProfileRecommendations() {
|
|
89
|
+
return this.withAuthRetry(async () => {
|
|
90
|
+
return await this.makeRequest('GET', '/api/profiles/recommendations', undefined, {
|
|
91
|
+
cache: true
|
|
92
|
+
});
|
|
93
|
+
}, 'getProfileRecommendations');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get user by ID
|
|
98
|
+
*/
|
|
99
|
+
async getUserById(userId) {
|
|
100
|
+
try {
|
|
101
|
+
return await this.makeRequest('GET', `/api/users/${userId}`, undefined, {
|
|
102
|
+
cache: true,
|
|
103
|
+
cacheTTL: 5 * 60 * 1000 // 5 minutes cache
|
|
104
|
+
});
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw this.handleError(error);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Get current user
|
|
112
|
+
*/
|
|
113
|
+
async getCurrentUser() {
|
|
114
|
+
return this.withAuthRetry(async () => {
|
|
115
|
+
return await this.makeRequest('GET', '/api/users/me', undefined, {
|
|
116
|
+
cache: true,
|
|
117
|
+
cacheTTL: 1 * 60 * 1000 // 1 minute cache for current user
|
|
118
|
+
});
|
|
119
|
+
}, 'getCurrentUser');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Update user profile
|
|
124
|
+
*/
|
|
125
|
+
async updateProfile(updates) {
|
|
126
|
+
try {
|
|
127
|
+
return await this.makeRequest('PUT', '/api/users/me', updates, {
|
|
128
|
+
cache: false
|
|
129
|
+
});
|
|
130
|
+
} catch (error) {
|
|
131
|
+
throw this.handleError(error);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Get privacy settings for a user
|
|
137
|
+
* @param userId - The user ID (defaults to current user)
|
|
138
|
+
*/
|
|
139
|
+
async getPrivacySettings(userId) {
|
|
140
|
+
try {
|
|
141
|
+
const id = userId || (await this.getCurrentUser()).id;
|
|
142
|
+
return await this.makeRequest('GET', `/api/privacy/${id}/privacy`, undefined, {
|
|
143
|
+
cache: true,
|
|
144
|
+
cacheTTL: 2 * 60 * 1000 // 2 minutes cache
|
|
145
|
+
});
|
|
146
|
+
} catch (error) {
|
|
147
|
+
throw this.handleError(error);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Update privacy settings
|
|
153
|
+
* @param settings - Partial privacy settings object
|
|
154
|
+
* @param userId - The user ID (defaults to current user)
|
|
155
|
+
*/
|
|
156
|
+
async updatePrivacySettings(settings, userId) {
|
|
157
|
+
try {
|
|
158
|
+
const id = userId || (await this.getCurrentUser()).id;
|
|
159
|
+
return await this.makeRequest('PATCH', `/api/privacy/${id}/privacy`, settings, {
|
|
160
|
+
cache: false
|
|
161
|
+
});
|
|
162
|
+
} catch (error) {
|
|
163
|
+
throw this.handleError(error);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Request account verification
|
|
169
|
+
*/
|
|
170
|
+
async requestAccountVerification(reason, evidence) {
|
|
171
|
+
try {
|
|
172
|
+
return await this.makeRequest('POST', '/api/users/verify/request', {
|
|
173
|
+
reason,
|
|
174
|
+
evidence
|
|
175
|
+
}, {
|
|
176
|
+
cache: false
|
|
177
|
+
});
|
|
178
|
+
} catch (error) {
|
|
179
|
+
throw this.handleError(error);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Download account data export
|
|
185
|
+
*/
|
|
186
|
+
async downloadAccountData(format = 'json') {
|
|
187
|
+
try {
|
|
188
|
+
// Use axios instance directly for blob responses since RequestManager doesn't handle blobs
|
|
189
|
+
const axiosInstance = this.getClient().getAxiosInstance();
|
|
190
|
+
const response = await axiosInstance.get(`/api/users/me/data?format=${format}`, {
|
|
191
|
+
responseType: 'blob'
|
|
192
|
+
});
|
|
193
|
+
return response.data;
|
|
194
|
+
} catch (error) {
|
|
195
|
+
throw this.handleError(error);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Delete account permanently
|
|
201
|
+
* @param password - User password for confirmation
|
|
202
|
+
* @param confirmText - Confirmation text (usually username)
|
|
203
|
+
*/
|
|
204
|
+
async deleteAccount(password, confirmText) {
|
|
205
|
+
try {
|
|
206
|
+
return await this.makeRequest('DELETE', '/api/users/me', {
|
|
207
|
+
password,
|
|
208
|
+
confirmText
|
|
209
|
+
}, {
|
|
210
|
+
cache: false
|
|
211
|
+
});
|
|
212
|
+
} catch (error) {
|
|
213
|
+
throw this.handleError(error);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Update user by ID (admin function)
|
|
219
|
+
*/
|
|
220
|
+
async updateUser(userId, updates) {
|
|
221
|
+
try {
|
|
222
|
+
return await this.makeRequest('PUT', `/api/users/${userId}`, updates, {
|
|
223
|
+
cache: false
|
|
224
|
+
});
|
|
225
|
+
} catch (error) {
|
|
226
|
+
throw this.handleError(error);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Follow a user
|
|
232
|
+
*/
|
|
233
|
+
async followUser(userId) {
|
|
234
|
+
try {
|
|
235
|
+
return await this.makeRequest('POST', `/api/users/${userId}/follow`, undefined, {
|
|
236
|
+
cache: false
|
|
237
|
+
});
|
|
238
|
+
} catch (error) {
|
|
239
|
+
throw this.handleError(error);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Unfollow a user
|
|
245
|
+
*/
|
|
246
|
+
async unfollowUser(userId) {
|
|
247
|
+
try {
|
|
248
|
+
return await this.makeRequest('DELETE', `/api/users/${userId}/follow`, undefined, {
|
|
249
|
+
cache: false
|
|
250
|
+
});
|
|
251
|
+
} catch (error) {
|
|
252
|
+
throw this.handleError(error);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Get follow status
|
|
258
|
+
*/
|
|
259
|
+
async getFollowStatus(userId) {
|
|
260
|
+
try {
|
|
261
|
+
return await this.makeRequest('GET', `/api/users/${userId}/follow-status`, undefined, {
|
|
262
|
+
cache: true,
|
|
263
|
+
cacheTTL: 1 * 60 * 1000 // 1 minute cache
|
|
264
|
+
});
|
|
265
|
+
} catch (error) {
|
|
266
|
+
throw this.handleError(error);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Get user followers
|
|
272
|
+
*/
|
|
273
|
+
async getUserFollowers(userId, pagination) {
|
|
274
|
+
try {
|
|
275
|
+
const params = (0, _apiUtils.buildPaginationParams)(pagination || {});
|
|
276
|
+
const response = await this.makeRequest('GET', `/api/users/${userId}/followers`, params, {
|
|
277
|
+
cache: true,
|
|
278
|
+
cacheTTL: 2 * 60 * 1000 // 2 minutes cache
|
|
279
|
+
});
|
|
280
|
+
return {
|
|
281
|
+
followers: response.data || [],
|
|
282
|
+
total: response.pagination.total,
|
|
283
|
+
hasMore: response.pagination.hasMore
|
|
284
|
+
};
|
|
285
|
+
} catch (error) {
|
|
286
|
+
throw this.handleError(error);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Get user following
|
|
292
|
+
*/
|
|
293
|
+
async getUserFollowing(userId, pagination) {
|
|
294
|
+
try {
|
|
295
|
+
const params = (0, _apiUtils.buildPaginationParams)(pagination || {});
|
|
296
|
+
const response = await this.makeRequest('GET', `/api/users/${userId}/following`, params, {
|
|
297
|
+
cache: true,
|
|
298
|
+
cacheTTL: 2 * 60 * 1000 // 2 minutes cache
|
|
299
|
+
});
|
|
300
|
+
return {
|
|
301
|
+
following: response.data || [],
|
|
302
|
+
total: response.pagination.total,
|
|
303
|
+
hasMore: response.pagination.hasMore
|
|
304
|
+
};
|
|
305
|
+
} catch (error) {
|
|
306
|
+
throw this.handleError(error);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Get notifications
|
|
312
|
+
*/
|
|
313
|
+
async getNotifications() {
|
|
314
|
+
return this.withAuthRetry(async () => {
|
|
315
|
+
return await this.makeRequest('GET', '/api/notifications', undefined, {
|
|
316
|
+
cache: false // Don't cache notifications - always get fresh data
|
|
317
|
+
});
|
|
318
|
+
}, 'getNotifications');
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Get unread notification count
|
|
323
|
+
*/
|
|
324
|
+
async getUnreadCount() {
|
|
325
|
+
try {
|
|
326
|
+
const res = await this.makeRequest('GET', '/api/notifications/unread-count', undefined, {
|
|
327
|
+
cache: false // Don't cache unread count - always get fresh data
|
|
328
|
+
});
|
|
329
|
+
return res.count;
|
|
330
|
+
} catch (error) {
|
|
331
|
+
throw this.handleError(error);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Create notification
|
|
337
|
+
*/
|
|
338
|
+
async createNotification(data) {
|
|
339
|
+
try {
|
|
340
|
+
return await this.makeRequest('POST', '/api/notifications', data, {
|
|
341
|
+
cache: false
|
|
342
|
+
});
|
|
343
|
+
} catch (error) {
|
|
344
|
+
throw this.handleError(error);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Mark notification as read
|
|
350
|
+
*/
|
|
351
|
+
async markNotificationAsRead(notificationId) {
|
|
352
|
+
try {
|
|
353
|
+
await this.makeRequest('PUT', `/api/notifications/${notificationId}/read`, undefined, {
|
|
354
|
+
cache: false
|
|
355
|
+
});
|
|
356
|
+
} catch (error) {
|
|
357
|
+
throw this.handleError(error);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Mark all notifications as read
|
|
363
|
+
*/
|
|
364
|
+
async markAllNotificationsAsRead() {
|
|
365
|
+
try {
|
|
366
|
+
await this.makeRequest('PUT', '/api/notifications/read-all', undefined, {
|
|
367
|
+
cache: false
|
|
368
|
+
});
|
|
369
|
+
} catch (error) {
|
|
370
|
+
throw this.handleError(error);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Delete notification
|
|
376
|
+
*/
|
|
377
|
+
async deleteNotification(notificationId) {
|
|
378
|
+
try {
|
|
379
|
+
await this.makeRequest('DELETE', `/api/notifications/${notificationId}`, undefined, {
|
|
380
|
+
cache: false
|
|
381
|
+
});
|
|
382
|
+
} catch (error) {
|
|
383
|
+
throw this.handleError(error);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
//# sourceMappingURL=OxyServices.user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_apiUtils","require","OxyServicesUserMixin","Base","constructor","args","getProfileByUsername","username","makeRequest","undefined","cache","cacheTTL","error","handleError","searchProfiles","query","pagination","params","searchParams","buildSearchParams","paramsObj","Object","fromEntries","entries","response","isSearchProfilesResponse","payload","Array","isArray","data","typedResponse","paginationInfo","total","length","limit","offset","hasMore","fallbackLimit","fallbackPagination","Error","getProfileRecommendations","withAuthRetry","getUserById","userId","getCurrentUser","updateProfile","updates","getPrivacySettings","id","updatePrivacySettings","settings","requestAccountVerification","reason","evidence","downloadAccountData","format","axiosInstance","getClient","getAxiosInstance","get","responseType","deleteAccount","password","confirmText","updateUser","followUser","unfollowUser","getFollowStatus","getUserFollowers","buildPaginationParams","followers","getUserFollowing","following","getNotifications","getUnreadCount","res","count","createNotification","markNotificationAsRead","notificationId","markAllNotificationsAsRead","deleteNotification"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.user.ts"],"mappings":";;;;;;AAKA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AS,EAAE;UAAEC,KAAK,EAAE;QAAM,CAAC,CAAC;MACvG,CAAC,CAAC,OAAOE,KAAK,EAAE;QACd,MAAM,IAAI,CAACC,WAAW,CAACD,KAAK,CAAC;MAC/B;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.OxyServicesUtilityMixin = OxyServicesUtilityMixin;
|
|
7
|
+
var _jwtDecode = require("jwt-decode");
|
|
8
|
+
var _mixinHelpers = require("./mixinHelpers");
|
|
9
|
+
/**
|
|
10
|
+
* Utility Methods Mixin
|
|
11
|
+
*
|
|
12
|
+
* Provides utility methods including link metadata fetching
|
|
13
|
+
* and Express.js authentication middleware
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
function OxyServicesUtilityMixin(Base) {
|
|
17
|
+
return class extends Base {
|
|
18
|
+
constructor(...args) {
|
|
19
|
+
super(...args);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetch link metadata
|
|
23
|
+
*/
|
|
24
|
+
async fetchLinkMetadata(url) {
|
|
25
|
+
try {
|
|
26
|
+
return await this.makeRequest('GET', '/api/link-metadata', {
|
|
27
|
+
url
|
|
28
|
+
}, {
|
|
29
|
+
cache: true,
|
|
30
|
+
cacheTTL: _mixinHelpers.CACHE_TIMES.EXTRA_LONG
|
|
31
|
+
});
|
|
32
|
+
} catch (error) {
|
|
33
|
+
throw this.handleError(error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Simple Express.js authentication middleware
|
|
39
|
+
*
|
|
40
|
+
* Built-in authentication middleware that validates JWT tokens and adds user data to requests.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* // Basic usage - just add it to your routes
|
|
45
|
+
* app.use('/api/protected', oxyServices.auth());
|
|
46
|
+
*
|
|
47
|
+
* // With debug logging
|
|
48
|
+
* app.use('/api/protected', oxyServices.auth({ debug: true }));
|
|
49
|
+
*
|
|
50
|
+
* // With custom error handling
|
|
51
|
+
* app.use('/api/protected', oxyServices.auth({
|
|
52
|
+
* onError: (error) => console.error('Auth failed:', error)
|
|
53
|
+
* }));
|
|
54
|
+
*
|
|
55
|
+
* // Load full user data
|
|
56
|
+
* app.use('/api/protected', oxyServices.auth({ loadUser: true }));
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param options Optional configuration
|
|
60
|
+
* @param options.debug Enable debug logging (default: false)
|
|
61
|
+
* @param options.onError Custom error handler
|
|
62
|
+
* @param options.loadUser Load full user data (default: false for performance)
|
|
63
|
+
* @param options.session Use session-based validation (default: false)
|
|
64
|
+
* @returns Express middleware function
|
|
65
|
+
*/
|
|
66
|
+
auth(options = {}) {
|
|
67
|
+
const {
|
|
68
|
+
debug = false,
|
|
69
|
+
onError,
|
|
70
|
+
loadUser = false,
|
|
71
|
+
session = false
|
|
72
|
+
} = options;
|
|
73
|
+
|
|
74
|
+
// Return a synchronous middleware function
|
|
75
|
+
return (req, res, next) => {
|
|
76
|
+
try {
|
|
77
|
+
// Extract token from Authorization header
|
|
78
|
+
const authHeader = req.headers['authorization'];
|
|
79
|
+
const token = authHeader?.startsWith('Bearer ') ? authHeader.substring(7) : null;
|
|
80
|
+
if (debug) {
|
|
81
|
+
console.log(`🔐 Auth: Processing ${req.method} ${req.path}`);
|
|
82
|
+
console.log(`🔐 Auth: Token present: ${!!token}`);
|
|
83
|
+
}
|
|
84
|
+
if (!token) {
|
|
85
|
+
const error = {
|
|
86
|
+
message: 'Access token required',
|
|
87
|
+
code: 'MISSING_TOKEN',
|
|
88
|
+
status: 401
|
|
89
|
+
};
|
|
90
|
+
if (debug) console.log(`❌ Auth: Missing token`);
|
|
91
|
+
if (onError) return onError(error);
|
|
92
|
+
return res.status(401).json(error);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Decode and validate token
|
|
96
|
+
let decoded;
|
|
97
|
+
try {
|
|
98
|
+
decoded = (0, _jwtDecode.jwtDecode)(token);
|
|
99
|
+
if (debug) {
|
|
100
|
+
console.log(`🔐 Auth: Token decoded, User ID: ${decoded.userId || decoded.id}`);
|
|
101
|
+
}
|
|
102
|
+
} catch (decodeError) {
|
|
103
|
+
const error = {
|
|
104
|
+
message: 'Invalid token format',
|
|
105
|
+
code: 'INVALID_TOKEN_FORMAT',
|
|
106
|
+
status: 403
|
|
107
|
+
};
|
|
108
|
+
if (debug) console.log(`❌ Auth: Token decode failed`);
|
|
109
|
+
if (onError) return onError(error);
|
|
110
|
+
return res.status(403).json(error);
|
|
111
|
+
}
|
|
112
|
+
const userId = decoded.userId || decoded.id;
|
|
113
|
+
if (!userId) {
|
|
114
|
+
const error = {
|
|
115
|
+
message: 'Token missing user ID',
|
|
116
|
+
code: 'INVALID_TOKEN_PAYLOAD',
|
|
117
|
+
status: 403
|
|
118
|
+
};
|
|
119
|
+
if (debug) console.log(`❌ Auth: Token missing user ID`);
|
|
120
|
+
if (onError) return onError(error);
|
|
121
|
+
return res.status(403).json(error);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Check token expiration
|
|
125
|
+
if (decoded.exp && decoded.exp < Math.floor(Date.now() / 1000)) {
|
|
126
|
+
const error = {
|
|
127
|
+
message: 'Token expired',
|
|
128
|
+
code: 'TOKEN_EXPIRED',
|
|
129
|
+
status: 403
|
|
130
|
+
};
|
|
131
|
+
if (debug) console.log(`❌ Auth: Token expired`);
|
|
132
|
+
if (onError) return onError(error);
|
|
133
|
+
return res.status(403).json(error);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// For now, skip session validation to keep it simple
|
|
137
|
+
// Session validation can be added later if needed
|
|
138
|
+
|
|
139
|
+
// Set request properties immediately
|
|
140
|
+
req.userId = userId;
|
|
141
|
+
req.accessToken = token;
|
|
142
|
+
req.user = {
|
|
143
|
+
id: userId
|
|
144
|
+
};
|
|
145
|
+
if (debug) {
|
|
146
|
+
console.log(`✅ Auth: Authentication successful for user ${userId}`);
|
|
147
|
+
}
|
|
148
|
+
next();
|
|
149
|
+
} catch (error) {
|
|
150
|
+
const apiError = this.handleError(error);
|
|
151
|
+
if (debug) {
|
|
152
|
+
console.log(`❌ Auth: Unexpected error:`, apiError);
|
|
153
|
+
}
|
|
154
|
+
if (onError) return onError(apiError);
|
|
155
|
+
return res.status(apiError && apiError.status || 500).json(apiError);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=OxyServices.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_jwtDecode","require","_mixinHelpers","OxyServicesUtilityMixin","Base","constructor","args","fetchLinkMetadata","url","makeRequest","cache","cacheTTL","CACHE_TIMES","EXTRA_LONG","error","handleError","auth","options","debug","onError","loadUser","session","req","res","next","authHeader","headers","token","startsWith","substring","console","log","method","path","message","code","status","json","decoded","jwtDecode","userId","id","decodeError","exp","Math","floor","Date","now","accessToken","user","apiError"],"sourceRoot":"../../../../src","sources":["core/mixins/OxyServices.utility.ts"],"mappings":";;;;;;AAMA,IAAAA,UAAA,GAAAC,OAAA;AAGA,IAAAC,aAAA,GAAAD,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;;AAcO,SAASE,uBAAuBA,CAAmCC,IAAO,EAAE;EACjF,OAAO,cAAcA,IAAI,CAAC;IACxBC,WAAWA,CAAC,GAAGC,IAAW,EAAE;MAC1B,KAAK,CAAC,GAAIA,IAAc,CAAC;IAC3B;IACA;AACJ;AACA;IACI,MAAMC,iBAAiBA,CAACC,GAAW,EAKhC;MACD,IAAI;QACF,OAAO,MAAM,IAAI,CAACC,WAAW,CAK1B,KAAK,EAAE,oBAAoB,EAAE;UAAED;QAAI,CAAC,EAAE;UACvCE,KAAK,EA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G;cACZoB,OAAO,EAAE,eAAe;cACxBC,IAAI,EAAE,eAAe;cACrBC,MAAM,EAAE;YACV,CAAC;YAED,IAAIlB,KAAK,EAAEY,OAAO,CAACC,GAAG,CAAC,uBAAuB,CAAC;YAE/C,IAAIZ,OAAO,EAAE,OAAOA,OAAO,CAACL,KAAK,CAAC;YAClC,OAAOS,GAAG,CAACa,MAAM,CAAC,GAAG,CAAC,CAACC,IAAI,CAACvB,KAAK,CAAC;UACpC;;UAEA;UACA;;UAEA;UACAQ,GAAG,CAACkB,MAAM,GAAGA,MAAM;UACnBlB,GAAG,CAAC0B,WAAW,GAAGrB,KAAK;UACvBL,GAAG,CAAC2B,IAAI,GAAG;YAAER,EAAE,EAAED;UAAO,CAAS;UAEjC,IAAItB,KAAK,EAAE;YACTY,OAAO,CAACC,GAAG,CAAC,8CAA8CS,MAAM,EAAE,CAAC;UACrE;UAEAhB,IAAI,CAAC,CAAC;QACR,CAAC,CAAC,OAAOV,KAAK,EAAE;UACd,MAAMoC,QAAQ,GAAG,IAAI,CAACnC,WAAW,CAACD,KAAK,CAAQ;UAE/C,IAAII,KAAK,EAAE;YACTY,OAAO,CAACC,GAAG,CAAC,2BAA2B,EAAEmB,QAAQ,CAAC;UACpD;UAEA,IAAI/B,OAAO,EAAE,OAAOA,OAAO,CAAC+B,QAAQ,CAAC;UACrC,OAAO3B,GAAG,CAACa,MAAM,CAAEc,QAAQ,IAAIA,QAAQ,CAACd,MAAM,IAAK,GAAG,CAAC,CAACC,IAAI,CAACa,QAAQ,CAAC;QACxE;MACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.composeOxyServices = composeOxyServices;
|
|
7
|
+
var _OxyServices = require("../OxyServices.base");
|
|
8
|
+
var _OxyServices2 = require("./OxyServices.auth");
|
|
9
|
+
var _OxyServices3 = require("./OxyServices.user");
|
|
10
|
+
var _OxyServices4 = require("./OxyServices.totp");
|
|
11
|
+
var _OxyServices5 = require("./OxyServices.privacy");
|
|
12
|
+
var _OxyServices6 = require("./OxyServices.language");
|
|
13
|
+
var _OxyServices7 = require("./OxyServices.payment");
|
|
14
|
+
var _OxyServices8 = require("./OxyServices.karma");
|
|
15
|
+
var _OxyServices9 = require("./OxyServices.assets");
|
|
16
|
+
var _OxyServices0 = require("./OxyServices.developer");
|
|
17
|
+
var _OxyServices1 = require("./OxyServices.location");
|
|
18
|
+
var _OxyServices10 = require("./OxyServices.analytics");
|
|
19
|
+
var _OxyServices11 = require("./OxyServices.devices");
|
|
20
|
+
var _OxyServices12 = require("./OxyServices.utility");
|
|
21
|
+
/**
|
|
22
|
+
* Centralized mixin exports and composition helper
|
|
23
|
+
*
|
|
24
|
+
* This module provides a clean way to compose all mixins
|
|
25
|
+
* and ensures consistent ordering for better maintainability
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Composes all OxyServices mixins in the correct order
|
|
30
|
+
*
|
|
31
|
+
* Order matters for mixins - dependencies should be applied first.
|
|
32
|
+
* This function ensures consistent composition across the codebase.
|
|
33
|
+
*
|
|
34
|
+
* @returns The fully composed OxyServices class with all mixins applied
|
|
35
|
+
*/
|
|
36
|
+
function composeOxyServices() {
|
|
37
|
+
return (0, _OxyServices12.OxyServicesUtilityMixin)((0, _OxyServices11.OxyServicesDevicesMixin)((0, _OxyServices10.OxyServicesAnalyticsMixin)((0, _OxyServices1.OxyServicesLocationMixin)((0, _OxyServices0.OxyServicesDeveloperMixin)((0, _OxyServices9.OxyServicesAssetsMixin)((0, _OxyServices8.OxyServicesKarmaMixin)((0, _OxyServices7.OxyServicesPaymentMixin)((0, _OxyServices6.OxyServicesLanguageMixin)((0, _OxyServices5.OxyServicesPrivacyMixin)((0, _OxyServices4.OxyServicesTotpMixin)((0, _OxyServices3.OxyServicesUserMixin)((0, _OxyServices2.OxyServicesAuthMixin)(_OxyServices.OxyServicesBase)))))))))))));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_OxyServices","require","_OxyServices2","_OxyServices3","_OxyServices4","_OxyServices5","_OxyServices6","_OxyServices7","_OxyServices8","_OxyServices9","_OxyServices0","_OxyServices1","_OxyServices10","_OxyServices11","_OxyServices12","composeOxyServices","OxyServicesUtilityMixin","OxyServicesDevicesMixin","OxyServicesAnalyticsMixin","OxyServicesLocationMixin","OxyServicesDeveloperMixin","OxyServicesAssetsMixin","OxyServicesKarmaMixin","OxyServicesPaymentMixin","OxyServicesLanguageMixin","OxyServicesPrivacyMixin","OxyServicesTotpMixin","OxyServicesUserMixin","OxyServicesAuthMixin","OxyServicesBase"],"sourceRoot":"../../../../src","sources":["core/mixins/index.ts"],"mappings":";;;;;;AAOA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAV,OAAA;AACA,IAAAW,cAAA,GAAAX,OAAA;AACA,IAAAY,cAAA,GAAAZ,OAAA;AACA,IAAAa,cAAA,GAAAb,OAAA;AApBA;AACA;AACA;AACA;AACA;AACA;;AAiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,kBAAkBA,CAAA,EAAG;EACnC,OAAO,IAAAC,sCAAuB,EAC5B,IAAAC,sCAAuB,EACrB,IAAAC,wCAAyB,EACvB,IAAAC,sCAAwB,EACtB,IAAAC,uCAAyB,EACvB,IAAAC,oCAAsB,EACpB,IAAAC,mCAAqB,EACnB,IAAAC,qCAAuB,EACrB,IAAAC,sCAAwB,EACtB,IAAAC,qCAAuB,EACrB,IAAAC,kCAAoB,EAClB,IAAAC,kCAAoB,EAClB,IAAAC,kCAAoB,EAACC,4BAAe,CACtC,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CACHE_TIMES = void 0;
|
|
7
|
+
exports.createApiMethod = createApiMethod;
|
|
8
|
+
exports.withErrorHandling = withErrorHandling;
|
|
9
|
+
/**
|
|
10
|
+
* Helper utilities for mixin classes
|
|
11
|
+
* Provides common patterns to reduce code duplication
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wraps an async method with standard error handling
|
|
16
|
+
* Reduces boilerplate in mixin methods
|
|
17
|
+
*/
|
|
18
|
+
async function withErrorHandling(operation, handleError) {
|
|
19
|
+
try {
|
|
20
|
+
return await operation();
|
|
21
|
+
} catch (error) {
|
|
22
|
+
throw handleError(error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a standard API request method with error handling
|
|
28
|
+
* Reduces duplication across mixin methods
|
|
29
|
+
*/
|
|
30
|
+
function createApiMethod(makeRequest, handleError, method, url, options = {}) {
|
|
31
|
+
return async (...args) => {
|
|
32
|
+
const urlString = typeof url === 'function' ? url(...args) : url;
|
|
33
|
+
const requestData = options.transformData ? options.transformData(args) : args[0];
|
|
34
|
+
const requestOptions = {
|
|
35
|
+
cache: options.cache ?? true,
|
|
36
|
+
cacheTTL: options.cacheTTL,
|
|
37
|
+
retry: options.retry ?? true
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
const response = await makeRequest(method, urlString, requestData, requestOptions);
|
|
41
|
+
return options.transformResponse ? options.transformResponse(response) : response;
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw handleError(error);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Cache time constants (in milliseconds)
|
|
50
|
+
*/
|
|
51
|
+
const CACHE_TIMES = exports.CACHE_TIMES = {
|
|
52
|
+
SHORT: 1 * 60 * 1000,
|
|
53
|
+
// 1 minute
|
|
54
|
+
MEDIUM: 2 * 60 * 1000,
|
|
55
|
+
// 2 minutes
|
|
56
|
+
LONG: 5 * 60 * 1000,
|
|
57
|
+
// 5 minutes
|
|
58
|
+
VERY_LONG: 10 * 60 * 1000,
|
|
59
|
+
// 10 minutes
|
|
60
|
+
EXTRA_LONG: 30 * 60 * 1000 // 30 minutes
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=mixinHelpers.js.map
|