@oxy.so/core 7.13.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/follows.js +12 -11
- package/dist/cjs/api/users.js +1 -1
- package/dist/cjs/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/cjs/i18n/locales/en-US.js +0 -2
- package/dist/cjs/i18n/locales/es-ES.js +0 -2
- package/dist/cjs/utils/identityCacheSweep.js +9 -1
- package/dist/esm/api/follows.js +12 -11
- package/dist/esm/api/users.js +2 -2
- package/dist/esm/i18n/locales/compact/es-ES.generated.js +1 -1
- package/dist/esm/i18n/locales/en-US.js +0 -2
- package/dist/esm/i18n/locales/es-ES.js +0 -2
- package/dist/esm/utils/identityCacheSweep.js +8 -1
- package/dist/types/i18n/locales/en-US.d.ts +0 -2
- package/dist/types/i18n/locales/es-ES.d.ts +0 -2
- package/dist/types/utils/identityCacheSweep.d.ts +5 -0
- package/package.json +1 -1
- package/src/api/follows.ts +21 -12
- package/src/api/users.ts +6 -2
- package/src/i18n/locales/compact/es-ES.generated.ts +1 -1
- package/src/i18n/locales/en-US.ts +0 -2
- package/src/i18n/locales/es-ES.ts +0 -2
- package/src/utils/identityCacheSweep.ts +9 -1
|
@@ -1897,7 +1897,6 @@ const dict = {
|
|
|
1897
1897
|
transfer: 'Transfer ownership',
|
|
1898
1898
|
},
|
|
1899
1899
|
errors: {
|
|
1900
|
-
emailRequired: 'Enter an email to invite.',
|
|
1901
1900
|
emailInvalid: 'Enter a valid email address, like name@example.com.',
|
|
1902
1901
|
missingAccount: 'No account selected.',
|
|
1903
1902
|
noPermission: 'You do not have permission to view members.',
|
|
@@ -2334,7 +2333,6 @@ const dict = {
|
|
|
2334
2333
|
newLabel: 'New password',
|
|
2335
2334
|
repeatLabel: 'Repeat the password',
|
|
2336
2335
|
tooShort: 'Use at least {{min}} characters.',
|
|
2337
|
-
tooLong: 'Use at most {{max}} characters.',
|
|
2338
2336
|
mismatch: "The passwords don't match.",
|
|
2339
2337
|
signOutOthers: 'Sign out everywhere else',
|
|
2340
2338
|
save: 'Save password',
|
|
@@ -1897,7 +1897,6 @@ const dict = {
|
|
|
1897
1897
|
transfer: 'Transferir propiedad',
|
|
1898
1898
|
},
|
|
1899
1899
|
errors: {
|
|
1900
|
-
emailRequired: 'Introduce un email para invitar.',
|
|
1901
1900
|
emailInvalid: 'Introduce un email válido, como nombre@ejemplo.com.',
|
|
1902
1901
|
missingAccount: 'Ninguna cuenta seleccionada.',
|
|
1903
1902
|
noPermission: 'No tienes permiso para ver los miembros.',
|
|
@@ -2334,7 +2333,6 @@ const dict = {
|
|
|
2334
2333
|
newLabel: 'Contraseña nueva',
|
|
2335
2334
|
repeatLabel: 'Repite la contraseña',
|
|
2336
2335
|
tooShort: 'Usa al menos {{min}} caracteres.',
|
|
2337
|
-
tooLong: 'Usa como máximo {{max}} caracteres.',
|
|
2338
2336
|
mismatch: 'Las contraseñas no coinciden.',
|
|
2339
2337
|
signOutOthers: 'Cerrar sesión en todos los demás sitios',
|
|
2340
2338
|
save: 'Guardar contraseña',
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
*/
|
|
54
54
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
55
55
|
exports.OXY_IDENTITY_CACHE_PREFIXES = void 0;
|
|
56
|
+
exports.oxyUserByIdPath = oxyUserByIdPath;
|
|
56
57
|
exports.oxyUserByIdCacheKey = oxyUserByIdCacheKey;
|
|
57
58
|
exports.evictOxyIdentityCache = evictOxyIdentityCache;
|
|
58
59
|
/**
|
|
@@ -69,12 +70,19 @@ exports.OXY_IDENTITY_CACHE_PREFIXES = [
|
|
|
69
70
|
// `resolveProfile` — keyed by fediverse handle in the query payload.
|
|
70
71
|
'GET:/profiles/resolve',
|
|
71
72
|
];
|
|
73
|
+
/**
|
|
74
|
+
* The path `getUserById` reads, its id encoded. Built in one place so the
|
|
75
|
+
* request and every key that evicts it cannot spell the id differently.
|
|
76
|
+
*/
|
|
77
|
+
function oxyUserByIdPath(userId) {
|
|
78
|
+
return `/users/${encodeURIComponent(userId)}`;
|
|
79
|
+
}
|
|
72
80
|
/**
|
|
73
81
|
* Build the exact cache key `getUserById` reads under. The only identity key
|
|
74
82
|
* derivable from a user id, so the only one that does not need a prefix sweep.
|
|
75
83
|
*/
|
|
76
84
|
function oxyUserByIdCacheKey(userId) {
|
|
77
|
-
return `GET
|
|
85
|
+
return `GET:${oxyUserByIdPath(userId)}`;
|
|
78
86
|
}
|
|
79
87
|
/**
|
|
80
88
|
* Sweep an `OxyServices` GET response cache of everything that could carry the
|
package/dist/esm/api/follows.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildPaginationParams, buildQueryParams, buildUrl, } from '../utils/apiUtils.js';
|
|
2
|
-
|
|
2
|
+
import { oxyUserByIdCacheKey, oxyUserByIdPath } from '../utils/identityCacheSweep.js';
|
|
3
3
|
const GRAPH_TTL = 2 * 60 * 1000;
|
|
4
4
|
const STATUS_TTL = 60 * 1000;
|
|
5
5
|
/**
|
|
@@ -14,7 +14,7 @@ export class FollowsApi {
|
|
|
14
14
|
// ── People ───────────────────────────────────────────────────────────────
|
|
15
15
|
/** Follow a user. */
|
|
16
16
|
async follow(userId) {
|
|
17
|
-
const result = await this.ctx.request('POST',
|
|
17
|
+
const result = await this.ctx.request('POST', `${oxyUserByIdPath(userId)}/follow`, undefined, { cache: false });
|
|
18
18
|
this.invalidate([userId]);
|
|
19
19
|
return result;
|
|
20
20
|
}
|
|
@@ -28,7 +28,7 @@ export class FollowsApi {
|
|
|
28
28
|
}
|
|
29
29
|
/** Unfollow a user. */
|
|
30
30
|
async unfollow(userId) {
|
|
31
|
-
const result = await this.ctx.request('DELETE',
|
|
31
|
+
const result = await this.ctx.request('DELETE', `${oxyUserByIdPath(userId)}/follow`, undefined, { cache: false });
|
|
32
32
|
this.invalidate([userId]);
|
|
33
33
|
return result;
|
|
34
34
|
}
|
|
@@ -42,7 +42,7 @@ export class FollowsApi {
|
|
|
42
42
|
}
|
|
43
43
|
/** Whether the signed-in user follows `userId`. Cached 1 minute, busted by every write. */
|
|
44
44
|
async status(userId) {
|
|
45
|
-
return this.ctx.request('GET',
|
|
45
|
+
return this.ctx.request('GET', `${oxyUserByIdPath(userId)}/follow-status`, undefined, {
|
|
46
46
|
cache: true,
|
|
47
47
|
cacheTTL: STATUS_TTL,
|
|
48
48
|
});
|
|
@@ -72,12 +72,12 @@ export class FollowsApi {
|
|
|
72
72
|
* `limit`/`offset`/`sort` combination is its own cache entry (2 minutes).
|
|
73
73
|
*/
|
|
74
74
|
async followers(userId, params) {
|
|
75
|
-
const { data, total, hasMore } = await this.userPage(
|
|
75
|
+
const { data, total, hasMore } = await this.userPage(`${oxyUserByIdPath(userId)}/followers`, params);
|
|
76
76
|
return { followers: data, total, hasMore };
|
|
77
77
|
}
|
|
78
78
|
/** Who a user follows. `sort` as in `followers`. */
|
|
79
79
|
async following(userId, params) {
|
|
80
|
-
const { data, total, hasMore } = await this.userPage(
|
|
80
|
+
const { data, total, hasMore } = await this.userPage(`${oxyUserByIdPath(userId)}/following`, params);
|
|
81
81
|
return { following: data, total, hasMore };
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
@@ -85,7 +85,7 @@ export class FollowsApi {
|
|
|
85
85
|
* `userId`.
|
|
86
86
|
*/
|
|
87
87
|
async mutuals(userId, params) {
|
|
88
|
-
const { data, total, hasMore } = await this.userPage(
|
|
88
|
+
const { data, total, hasMore } = await this.userPage(`${oxyUserByIdPath(userId)}/mutuals`, params);
|
|
89
89
|
return { mutuals: data, total, hasMore };
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
@@ -220,16 +220,17 @@ export class FollowsApi {
|
|
|
220
220
|
const keys = ['GET:/users/me/graph'];
|
|
221
221
|
const prefixes = ['GET:/profiles/username/', 'GET:/profiles/resolve'];
|
|
222
222
|
for (const id of targetUserIds) {
|
|
223
|
-
|
|
223
|
+
const user = oxyUserByIdPath(id);
|
|
224
|
+
keys.push(`GET:${user}/follow-status`);
|
|
224
225
|
// Profiles embed the viewer-relative `relationship`.
|
|
225
|
-
keys.push(
|
|
226
|
+
keys.push(oxyUserByIdCacheKey(id));
|
|
226
227
|
// The target gained or lost a follower, and "followers you know" with it.
|
|
227
|
-
prefixes.push(`GET
|
|
228
|
+
prefixes.push(`GET:${user}/followers`, `GET:${user}/mutuals`);
|
|
228
229
|
}
|
|
229
230
|
// The viewer's own following list changed.
|
|
230
231
|
const viewerId = this.ctx.oxy.session.userId;
|
|
231
232
|
if (viewerId)
|
|
232
|
-
prefixes.push(`GET
|
|
233
|
+
prefixes.push(`GET:${oxyUserByIdPath(viewerId)}/following`);
|
|
233
234
|
this.ctx.http.invalidateCache({ keys, prefixes });
|
|
234
235
|
}
|
|
235
236
|
}
|
package/dist/esm/api/users.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
@@ -26,7 +26,7 @@ export class UsersApi {
|
|
|
26
26
|
* registry-fresh read that neither serves nor overwrites a cached entry.
|
|
27
27
|
*/
|
|
28
28
|
async get(userId, options) {
|
|
29
|
-
const user = await this.ctx.request('GET',
|
|
29
|
+
const user = await this.ctx.request('GET', oxyUserByIdPath(userId), undefined, {
|
|
30
30
|
cache: options?.cache ?? true,
|
|
31
31
|
cacheTTL: PROFILE_TTL,
|
|
32
32
|
});
|