@managemint-solutions/entities 1.18.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.
|
@@ -4,6 +4,13 @@ import type { ConfigEntity } from '../configs';
|
|
|
4
4
|
* it in Supabase Studio; the api reads it by this name and caches the value for a day.
|
|
5
5
|
*/
|
|
6
6
|
export declare const FEATURE_FLAGS_CONFIG_NAME = "portal_feature_flags";
|
|
7
|
+
/**
|
|
8
|
+
* The Redis entry the api writes the flags to, and the portal reads first - the same
|
|
9
|
+
* entry, so one write serves both. Bump the version when the wire shape changes; old
|
|
10
|
+
* entries simply stop matching.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FEATURE_FLAGS_CACHE_VERSION = "v1";
|
|
13
|
+
export declare const FEATURE_FLAGS_CACHE_KEY = "config:v1:portal_feature_flags";
|
|
7
14
|
/**
|
|
8
15
|
* One flag's rule: `true` for everyone, `false` for no one, or on only for the listed
|
|
9
16
|
* emails. Anything else - a missing flag, a malformed rule - is read as off by the portal.
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FEATURE_FLAGS_CONFIG_NAME = void 0;
|
|
3
|
+
exports.FEATURE_FLAGS_CACHE_KEY = exports.FEATURE_FLAGS_CACHE_VERSION = exports.FEATURE_FLAGS_CONFIG_NAME = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The row of `public.configs` that holds the portal's feature flags. Scott creates and edits
|
|
6
6
|
* it in Supabase Studio; the api reads it by this name and caches the value for a day.
|
|
7
7
|
*/
|
|
8
8
|
exports.FEATURE_FLAGS_CONFIG_NAME = 'portal_feature_flags';
|
|
9
|
+
/**
|
|
10
|
+
* The Redis entry the api writes the flags to, and the portal reads first - the same
|
|
11
|
+
* entry, so one write serves both. Bump the version when the wire shape changes; old
|
|
12
|
+
* entries simply stop matching.
|
|
13
|
+
*/
|
|
14
|
+
exports.FEATURE_FLAGS_CACHE_VERSION = 'v1';
|
|
15
|
+
exports.FEATURE_FLAGS_CACHE_KEY = `config:${exports.FEATURE_FLAGS_CACHE_VERSION}:${exports.FEATURE_FLAGS_CONFIG_NAME}`;
|
|
@@ -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