@managemint-solutions/entities 1.16.0 → 1.18.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.
@@ -0,0 +1,11 @@
1
+ import type { ConfigValue } from '../index';
2
+ export type CreateConfigDto = {
3
+ name: string;
4
+ description?: string;
5
+ value?: ConfigValue;
6
+ };
7
+ /** `value` replaces the whole object — it is not merged. `name` is the lookup key and is not editable here. */
8
+ export type UpdateConfigDto = {
9
+ description?: string;
10
+ value?: ConfigValue;
11
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import type { UUID } from 'crypto';
2
+ /** Any JSON value. */
3
+ export type JsonValue = string | number | boolean | null | JsonValue[] | {
4
+ [key: string]: JsonValue;
5
+ };
6
+ /** The `value` column: one JSON object keyed by setting name. */
7
+ export type ConfigValue = Record<string, JsonValue>;
8
+ /**
9
+ * One named config — a row of `public.configs`. Global: there is no organization on the row.
10
+ * Every signed-in caller may read; only the service role writes. A feature-flag set is just a
11
+ * row someone named in Supabase Studio, not a concept the code knows about.
12
+ */
13
+ export type ConfigEntity = {
14
+ mms_id: UUID;
15
+ created_at: string;
16
+ updated_at: string | null;
17
+ name: string;
18
+ description: string;
19
+ value: ConfigValue;
20
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import type { ConfigEntity } from '../configs';
2
+ /**
3
+ * The row of `public.configs` that holds the portal's feature flags. Scott creates and edits
4
+ * it in Supabase Studio; the api reads it by this name and caches the value for a day.
5
+ */
6
+ export declare const FEATURE_FLAGS_CONFIG_NAME = "portal_feature_flags";
7
+ /**
8
+ * One flag's rule: `true` for everyone, `false` for no one, or on only for the listed
9
+ * emails. Anything else - a missing flag, a malformed rule - is read as off by the portal.
10
+ */
11
+ export type FeatureFlagRule = boolean | {
12
+ emails: string[];
13
+ };
14
+ /** The `value` of the flags row: one rule per flag, keyed by the flag's name. */
15
+ export type FeatureFlags = Record<string, FeatureFlagRule>;
16
+ /** The flags row itself: a config whose name is fixed and whose value is the flag map. */
17
+ export interface FeatureFlagsConfig extends ConfigEntity {
18
+ name: typeof FEATURE_FLAGS_CONFIG_NAME;
19
+ value: FeatureFlags;
20
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FEATURE_FLAGS_CONFIG_NAME = void 0;
4
+ /**
5
+ * The row of `public.configs` that holds the portal's feature flags. Scott creates and edits
6
+ * it in Supabase Studio; the api reads it by this name and caches the value for a day.
7
+ */
8
+ exports.FEATURE_FLAGS_CONFIG_NAME = 'portal_feature_flags';
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * The contract for the portal's edge cache of each member's own `GET /users/me`.
3
3
  *
4
- * The portal owns the cache (Vercel Runtime Cache, one entry per member, written on a
5
- * miss); the api never reads it and only expires tags after a write. Both sides import
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
6
  * these so a change to the shape or the tagging is one edit.
7
7
  */
8
8
  /** Bump when the LoggedInUser wire shape changes; old entries simply stop matching. */
@@ -2,8 +2,8 @@
2
2
  /**
3
3
  * The contract for the portal's edge cache of each member's own `GET /users/me`.
4
4
  *
5
- * The portal owns the cache (Vercel Runtime Cache, one entry per member, written on a
6
- * miss); the api never reads it and only expires tags after a write. Both sides import
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
7
  * these so a change to the shape or the tagging is one edit.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@managemint-solutions/entities",
3
- "version": "1.16.0",
3
+ "version": "1.18.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": {