@oxy.so/core 7.12.0 → 7.13.1
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/dist/cjs/api/apps.js +1 -1
- package/dist/cjs/api/auth.js +1 -1
- package/dist/cjs/api/billing.js +4 -3
- package/dist/cjs/api/devices.js +5 -4
- package/dist/cjs/api/follows.js +12 -10
- package/dist/cjs/api/privacy.js +8 -7
- package/dist/cjs/api/session.js +10 -7
- package/dist/cjs/api/topics.js +4 -3
- package/dist/cjs/api/users.js +5 -4
- package/dist/cjs/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/cjs/i18n/locales/en-US.js +38 -15
- package/dist/cjs/i18n/locales/es-ES.js +38 -15
- package/dist/cjs/utils/identityCacheSweep.js +9 -1
- package/dist/esm/api/apps.js +1 -1
- package/dist/esm/api/auth.js +1 -1
- package/dist/esm/api/billing.js +4 -3
- package/dist/esm/api/devices.js +5 -4
- package/dist/esm/api/follows.js +12 -10
- package/dist/esm/api/privacy.js +8 -7
- package/dist/esm/api/session.js +10 -7
- package/dist/esm/api/topics.js +4 -3
- package/dist/esm/api/users.js +6 -5
- package/dist/esm/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/esm/i18n/locales/en-US.js +38 -15
- package/dist/esm/i18n/locales/es-ES.js +38 -15
- package/dist/esm/utils/identityCacheSweep.js +8 -1
- package/dist/types/i18n/locales/en-US.d.ts +35 -12
- package/dist/types/i18n/locales/es-ES.d.ts +35 -12
- package/dist/types/utils/identityCacheSweep.d.ts +5 -0
- package/package.json +2 -2
- package/src/api/apps.ts +1 -1
- package/src/api/auth.ts +9 -4
- package/src/api/billing.ts +12 -5
- package/src/api/devices.ts +6 -4
- package/src/api/follows.ts +21 -10
- package/src/api/privacy.ts +9 -7
- package/src/api/session.ts +18 -9
- package/src/api/topics.ts +5 -3
- package/src/api/users.ts +11 -5
- package/src/i18n/locales/compact/es-ES.generated.ts +1 -1
- package/src/i18n/locales/en-US.ts +39 -15
- package/src/i18n/locales/es-ES.ts +40 -15
- package/src/utils/identityCacheSweep.ts +9 -1
package/dist/esm/api/users.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { recommendationRequestCheck, parseContract } from '@oxy.so/contracts/client';
|
|
2
2
|
import { buildQueryParams } from '../utils/apiUtils.js';
|
|
3
3
|
import { normalizeUserIdentity, normalizeUserIdentityOrNull } from '../utils/userIdentity.js';
|
|
4
|
-
import { OXY_IDENTITY_CACHE_PREFIXES, oxyUserByIdCacheKey } from '../utils/identityCacheSweep.js';
|
|
4
|
+
import { OXY_IDENTITY_CACHE_PREFIXES, oxyUserByIdCacheKey, oxyUserByIdPath, } from '../utils/identityCacheSweep.js';
|
|
5
5
|
import { OXY_ACCOUNT_LIST_CACHE_KEY, OXY_ACCOUNT_LIST_CACHE_QUERY_PREFIX, oxyAccountDetailCacheKey, } from '../utils/accountCacheSweep.js';
|
|
6
6
|
import { extractErrorStatus } from '../utils/errorUtils.js';
|
|
7
7
|
import { runBatchLookup } from '../utils/batchLookup.js';
|
|
8
8
|
import { logger } from '../logger/index.js';
|
|
9
|
+
const enc = encodeURIComponent;
|
|
9
10
|
const PROFILE_TTL = 5 * 60 * 1000;
|
|
10
11
|
const SESSION_USER_TTL = 2 * 60 * 1000;
|
|
11
12
|
const ME_TTL = 60 * 1000;
|
|
@@ -25,7 +26,7 @@ export class UsersApi {
|
|
|
25
26
|
* registry-fresh read that neither serves nor overwrites a cached entry.
|
|
26
27
|
*/
|
|
27
28
|
async get(userId, options) {
|
|
28
|
-
const user = await this.ctx.request('GET',
|
|
29
|
+
const user = await this.ctx.request('GET', oxyUserByIdPath(userId), undefined, {
|
|
29
30
|
cache: options?.cache ?? true,
|
|
30
31
|
cacheTTL: PROFILE_TTL,
|
|
31
32
|
});
|
|
@@ -107,7 +108,7 @@ export class UsersApi {
|
|
|
107
108
|
}
|
|
108
109
|
/** The user a session belongs to. */
|
|
109
110
|
async bySession(sessionId) {
|
|
110
|
-
const user = await this.ctx.request('GET', `/session/user/${sessionId}`, undefined, {
|
|
111
|
+
const user = await this.ctx.request('GET', `/session/user/${enc(sessionId)}`, undefined, {
|
|
111
112
|
cache: true,
|
|
112
113
|
cacheTTL: SESSION_USER_TTL,
|
|
113
114
|
});
|
|
@@ -183,7 +184,7 @@ export class UsersApi {
|
|
|
183
184
|
const pagination = typeof limitOrPagination === 'number'
|
|
184
185
|
? { limit: limitOrPagination }
|
|
185
186
|
: (limitOrPagination ?? {});
|
|
186
|
-
const users = await this.ctx.request('GET', `/profiles/${userId}/similar`, buildQueryParams(pagination), {
|
|
187
|
+
const users = await this.ctx.request('GET', `/profiles/${enc(userId)}/similar`, buildQueryParams(pagination), {
|
|
187
188
|
cache: true,
|
|
188
189
|
cacheTTL: PROFILE_TTL,
|
|
189
190
|
});
|
|
@@ -195,7 +196,7 @@ export class UsersApi {
|
|
|
195
196
|
* account. Cached 5 minutes.
|
|
196
197
|
*/
|
|
197
198
|
async moderators(communityId) {
|
|
198
|
-
const moderators = await this.ctx.request('GET', `/users/${communityId}/moderators`, undefined, { cache: true, cacheTTL: PROFILE_TTL });
|
|
199
|
+
const moderators = await this.ctx.request('GET', `/users/${enc(communityId)}/moderators`, undefined, { cache: true, cacheTTL: PROFILE_TTL });
|
|
199
200
|
return moderators.map((user) => normalizeUserIdentity(user));
|
|
200
201
|
}
|
|
201
202
|
/**
|