@oxyhq/core 5.4.2 → 5.4.3

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.
@@ -19,12 +19,23 @@ function OxyServicesUserMixin(Base) {
19
19
  super(...args);
20
20
  }
21
21
  /**
22
- * Get profile by username
23
- */
24
- async getProfileByUsername(username) {
22
+ * Get profile by username.
23
+ *
24
+ * @param username - The profile's username.
25
+ * @param options.cache - Defaults to `true` (5-minute TTL), matching prior
26
+ * behavior. Pass `{ cache: false }` to force a registry-fresh read: the
27
+ * request bypasses BOTH the cache lookup and the post-fetch cache write
28
+ * (see {@link HttpService.request}'s `cache` handling), so it neither
29
+ * serves nor overwrites any entry already cached for this key — a
30
+ * previously cached response (if one exists) is left in place until its
31
+ * own TTL expires or is explicitly invalidated elsewhere. Use this when a
32
+ * caller must observe a just-written change (e.g. a privacy/consent flag)
33
+ * that would otherwise be masked by the TTL window.
34
+ */
35
+ async getProfileByUsername(username, options) {
25
36
  try {
26
37
  const user = await this.makeRequest('GET', `/profiles/username/${username}`, undefined, {
27
- cache: true,
38
+ cache: options?.cache ?? true,
28
39
  cacheTTL: 5 * 60 * 1000, // 5 minutes cache for profiles
29
40
  });
30
41
  return (0, userIdentity_1.normalizeUserIdentity)(user);
@@ -207,12 +218,23 @@ function OxyServicesUserMixin(Base) {
207
218
  return users.map((user) => (0, userIdentity_1.normalizeUserIdentity)(user));
208
219
  }
209
220
  /**
210
- * Get user by ID
211
- */
212
- async getUserById(userId) {
221
+ * Get user by ID.
222
+ *
223
+ * @param userId - The target user's id.
224
+ * @param options.cache - Defaults to `true` (5-minute TTL), matching prior
225
+ * behavior. Pass `{ cache: false }` to force a registry-fresh read: the
226
+ * request bypasses BOTH the cache lookup and the post-fetch cache write
227
+ * (see {@link HttpService.request}'s `cache` handling), so it neither
228
+ * serves nor overwrites any entry already cached for this key — a
229
+ * previously cached response (if one exists) is left in place until its
230
+ * own TTL expires or is explicitly invalidated elsewhere. Use this when a
231
+ * caller must observe a just-written change (e.g. a privacy/consent flag)
232
+ * that would otherwise be masked by the TTL window.
233
+ */
234
+ async getUserById(userId, options) {
213
235
  try {
214
236
  const user = await this.makeRequest('GET', `/users/${userId}`, undefined, {
215
- cache: true,
237
+ cache: options?.cache ?? true,
216
238
  cacheTTL: 5 * 60 * 1000, // 5 minutes cache
217
239
  });
218
240
  return (0, userIdentity_1.normalizeUserIdentity)(user);