@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.
@@ -1,20 +1,19 @@
1
1
  /**
2
- * The contract for the portal's edge cache of each member's own `GET /users/me`.
2
+ * The contract for the portal's Redis cache of each member's own `GET /users/me`.
3
3
  *
4
- * The portal owns the cache (Upstash Redis through the sdk cache subpath, one entry per
5
- * member, written on a miss); the api never reads it and only invalidates tags after a write. Both sides import
6
- * these so a change to the shape or the tagging is one edit.
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 entries simply stop matching. */
9
- export declare const USER_ME_CACHE_VERSION = "v1";
10
- /** The hard ceiling on how stale a cached profile may be, in seconds (one day). */
11
- export declare const USER_ME_CACHE_TTL_SECONDS = 86400;
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
- * Expiring this tag drops every member's blob in the organization - a write that changes
18
- * what all of them see (the module set folded into their permissions).
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 organizationCacheTag: (organizationId: string) => string;
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 edge cache of each member's own `GET /users/me`.
3
+ * The contract for the portal's Redis cache of each member's own `GET /users/me`.
4
4
  *
5
- * The portal owns the cache (Upstash Redis through the sdk cache subpath, one entry per
6
- * member, written on a miss); the api never reads it and only invalidates tags after a write. Both sides import
7
- * these so a change to the shape or the tagging is one edit.
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.organizationCacheTag = exports.userCacheTag = exports.userMeCacheKey = exports.USER_ME_CACHE_TTL_SECONDS = exports.USER_ME_CACHE_VERSION = void 0;
11
- /** Bump when the LoggedInUser wire shape changes; old entries simply stop matching. */
12
- exports.USER_ME_CACHE_VERSION = 'v1';
13
- /** The hard ceiling on how stale a cached profile may be, in seconds (one day). */
14
- exports.USER_ME_CACHE_TTL_SECONDS = 86400;
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
- * Expiring this tag drops every member's blob in the organization - a write that changes
23
- * what all of them see (the module set folded into their permissions).
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
- const organizationCacheTag = (organizationId) => `org:${organizationId}`;
26
- exports.organizationCacheTag = organizationCacheTag;
22
+ exports.PROFILE_CACHE_TTL_SECONDS = 86400;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "description": "Entity types used by both the api and portal",
5
5
  "homepage": "https://github.com/ManageMint-Solutions/managemint-solutions-entities#readme",
6
6
  "bugs": {