@managemint-solutions/entities 1.19.0 → 1.20.0
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/users/cache/index.d.ts +14 -15
- package/dist/users/cache/index.js +15 -19
- package/package.json +1 -1
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The contract for the portal's
|
|
2
|
+
* The contract for the portal's Redis cache of each member's own `GET /users/me`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* One hash per organization, `profiles:v1:<organization_id>`, with one field per member
|
|
5
|
+
* named by their `mms_id` and holding their `LoggedInUser`. The portal writes a field on a
|
|
6
|
+
* miss; the api never reads the hash and only deletes a field (a member's write) or the
|
|
7
|
+
* whole hash (a write that changes every member's profile). Both sides build the key from
|
|
8
|
+
* these constants - the builder itself lives in `@managemint-solutions/sdk/cache`.
|
|
7
9
|
*/
|
|
8
|
-
/** Bump when the LoggedInUser wire shape changes; old
|
|
9
|
-
export declare const
|
|
10
|
-
/** The
|
|
11
|
-
export declare const
|
|
12
|
-
/** The cache key of one member's LoggedInUser blob. Portal-internal; versioned here. */
|
|
13
|
-
export declare const userMeCacheKey: (mmsId: string) => string;
|
|
14
|
-
/** Expiring this tag drops one member's blob - every write to that member's row or permissions. */
|
|
15
|
-
export declare const userCacheTag: (mmsId: string) => string;
|
|
10
|
+
/** Bump when the LoggedInUser wire shape changes; old hashes simply stop matching. */
|
|
11
|
+
export declare const PROFILE_CACHE_VERSION = "v1";
|
|
12
|
+
/** The hash key is this prefix followed by the organization's `mms_id`. */
|
|
13
|
+
export declare const PROFILE_CACHE_KEY_PREFIX = "profiles:v1:";
|
|
16
14
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* The hard ceiling on how stale a cached profile may be, in seconds (one day). Set once,
|
|
16
|
+
* when a hash is first written, so an organization's whole cache re-reads once a day
|
|
17
|
+
* however busy it is.
|
|
19
18
|
*/
|
|
20
|
-
export declare const
|
|
19
|
+
export declare const PROFILE_CACHE_TTL_SECONDS = 86400;
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* The contract for the portal's
|
|
3
|
+
* The contract for the portal's Redis cache of each member's own `GET /users/me`.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* One hash per organization, `profiles:v1:<organization_id>`, with one field per member
|
|
6
|
+
* named by their `mms_id` and holding their `LoggedInUser`. The portal writes a field on a
|
|
7
|
+
* miss; the api never reads the hash and only deletes a field (a member's write) or the
|
|
8
|
+
* whole hash (a write that changes every member's profile). Both sides build the key from
|
|
9
|
+
* these constants - the builder itself lives in `@managemint-solutions/sdk/cache`.
|
|
8
10
|
*/
|
|
9
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.
|
|
11
|
-
/** Bump when the LoggedInUser wire shape changes; old
|
|
12
|
-
exports.
|
|
13
|
-
/** The
|
|
14
|
-
exports.
|
|
15
|
-
/** The cache key of one member's LoggedInUser blob. Portal-internal; versioned here. */
|
|
16
|
-
const userMeCacheKey = (mmsId) => `user:me:${exports.USER_ME_CACHE_VERSION}:${mmsId}`;
|
|
17
|
-
exports.userMeCacheKey = userMeCacheKey;
|
|
18
|
-
/** Expiring this tag drops one member's blob - every write to that member's row or permissions. */
|
|
19
|
-
const userCacheTag = (mmsId) => `user:${mmsId}`;
|
|
20
|
-
exports.userCacheTag = userCacheTag;
|
|
12
|
+
exports.PROFILE_CACHE_TTL_SECONDS = exports.PROFILE_CACHE_KEY_PREFIX = exports.PROFILE_CACHE_VERSION = void 0;
|
|
13
|
+
/** Bump when the LoggedInUser wire shape changes; old hashes simply stop matching. */
|
|
14
|
+
exports.PROFILE_CACHE_VERSION = 'v1';
|
|
15
|
+
/** The hash key is this prefix followed by the organization's `mms_id`. */
|
|
16
|
+
exports.PROFILE_CACHE_KEY_PREFIX = `profiles:${exports.PROFILE_CACHE_VERSION}:`;
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
18
|
+
* The hard ceiling on how stale a cached profile may be, in seconds (one day). Set once,
|
|
19
|
+
* when a hash is first written, so an organization's whole cache re-reads once a day
|
|
20
|
+
* however busy it is.
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
|
-
exports.organizationCacheTag = organizationCacheTag;
|
|
22
|
+
exports.PROFILE_CACHE_TTL_SECONDS = 86400;
|
package/package.json
CHANGED