@happyvertical/smrt-features 0.60.13 → 0.60.15
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/AGENTS.md +27 -4
- package/README.md +49 -3
- package/dist/feature-grants.d.ts +31 -0
- package/dist/feature-grants.d.ts.map +1 -0
- package/dist/feature-resolver.d.ts +20 -1
- package/dist/feature-resolver.d.ts.map +1 -1
- package/dist/feature-sync.d.ts +8 -0
- package/dist/feature-sync.d.ts.map +1 -1
- package/dist/framework-features.d.ts +27 -0
- package/dist/framework-features.d.ts.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +351 -16
- package/dist/index.js.map +1 -1
- package/dist/kill-switch.d.ts +77 -0
- package/dist/kill-switch.d.ts.map +1 -0
- package/dist/manifest.json +1 -1
- package/dist/require-feature.d.ts +102 -0
- package/dist/require-feature.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +5 -5
- package/dist/smrt-knowledge.okf.md +2 -2
- package/dist/standard-features.d.ts +36 -0
- package/dist/standard-features.d.ts.map +1 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +6 -6
package/AGENTS.md
CHANGED
|
@@ -14,11 +14,34 @@ Code-first feature flag system with global and tenant-hierarchy resolution.
|
|
|
14
14
|
|
|
15
15
|
## Resolution chain (priority high → low)
|
|
16
16
|
|
|
17
|
-
1. Tenant scope (`scopeType: 'tenant'`) — root-to-leaf traversal; a child inherits only when its parent allows cascading and it allows inheritance, otherwise its baseline resets to global
|
|
18
|
-
2. Global scope (`scopeType: 'global'`, `scopeId: GLOBAL_FEATURE_SCOPE_ID`)
|
|
19
|
-
3.
|
|
17
|
+
1. Tenant scope (`scopeType: 'tenant'`) — root-to-leaf traversal; a child inherits only when its parent allows cascading and it allows inheritance, otherwise its baseline resets to the post-global state (grant, then global override)
|
|
18
|
+
2. Global scope (`scopeType: 'global'`, `scopeId: GLOBAL_FEATURE_SCOPE_ID`) — applies on top of the grant; `inherit` keeps the granted state
|
|
19
|
+
3. Plan grant (#4761) — a key the tenant's plan grants becomes enabled; an ungranted key keeps its default
|
|
20
|
+
4. Boolean `defaultEnabled` from the registered class or framework definition, falling back to its synced definition
|
|
20
21
|
|
|
21
|
-
`FeatureResolver` is instantiated with database options; call `isEnabled(key, { tenantId })` or `isEnabledFor(Class, localId, { tenantId })` on that instance. With no tenant context only global/default apply. There is no user scope.
|
|
22
|
+
`FeatureResolver` is instantiated with database options; call `isEnabled(key, { tenantId, grantSource? })`, `explain(key, context)` (`{ enabled, decidedBy }`, the layer that set the state; the gate reads it), or `isEnabledFor(Class, localId, { tenantId })` on that instance. With no tenant context only global/default apply (grants are tenant-level). There is no user scope.
|
|
23
|
+
|
|
24
|
+
## Plan grants, standard keys, gates (#4761)
|
|
25
|
+
|
|
26
|
+
- **Grant source slot.** Features never imports `smrt-subscriptions`. A `FeatureGrantSource` (`getGrants(tenantId)`, optional `findGrantingPlan()`) is taken from `context.grantSource`, else `FeatureResolverOptions.grantSource`, else the global slot (`setFeatureGrantSource()`, stored under `Symbol.for(FEATURE_GRANT_SOURCE_SLOT_KEY)`; `smrt-subscriptions` writes the same key, so never rename it). `null` at either level disables grants. No source = no grants = pre-#4761 behavior. A global override outranks a plan grant: a global row is an explicit operator act, so a global DISABLE stops the feature fleet-wide, granted tenants included. Tenant overrides still beat both (the per-tenant escape hatch). Grant-source errors propagate (an outage must not read as "no plan").
|
|
27
|
+
- **Framework features** (`framework-features.ts`): dotted keys (`inference.hosted`) owned by no class, registered on `globalThis` via `defineFrameworkFeature()` (identical re-definition is a no-op, a conflicting one throws). The resolver reads their default before the class registry. `FeatureSyncService.syncFrameworkDefinitions()` upserts them as rows with an empty `qualifiedClassName`; class-sync pruning skips those rows.
|
|
28
|
+
- **Standard paid keys** (`standard-features.ts`): `FEATURE_SYNC_DEVICES`, `FEATURE_BACKUP_VAULT`, `FEATURE_CLOUD_HOSTED`, `FEATURE_INFERENCE_HOSTED`, `FEATURE_PLUGINS_REMOTE` (also `STANDARD_FEATURE_KEYS`, `STANDARD_FEATURES`); all `metadata.paid: true`, default off, seeded lazily (no import side effect). Gates import the constants, never string literals; plans grant the same strings.
|
|
29
|
+
- **Gates** (`require-feature.ts`): `requireFeature(key, { resolver, tenantId, grantSource? })` throws `FeatureUnavailableError` (`status` 403, `.code`, `.denial`, `.toResponse()`) for services; `featureGateResponse()` returns `null` or the JSON denial `Response` (`featureDenialResponse()`) for SvelteKit routes; `checkFeature()` returns `{ allowed, featureKey, denial? }`. `FeatureGateDenial` is a union discriminated by `code`, sharing `featureKey`, `label`, `paid`, `tenantId`, `message`: `feature_upgrade_required` (`FEATURE_UPGRADE_REQUIRED_CODE`) adds `grantingPlan`; `feature_disabled` (`FEATURE_DISABLED_CODE`) adds `disabledBy` and names no plan. The gate answers `feature_disabled` when `explain()` reports a global or tenant DISABLE decided the state (no upgrade could help) and never calls `findGrantingPlan()` then; otherwise a failing plan lookup only nulls `grantingPlan`. Never a bare 403. Semantics are "feature present", not identity: callers authenticate and authorize the principal and pass the tenant they verified.
|
|
30
|
+
|
|
31
|
+
## Kill switches (#4760)
|
|
32
|
+
|
|
33
|
+
`src/kill-switch.ts`: `readKillSwitch()` / `setKillSwitch()` /
|
|
34
|
+
`KillSwitchService` store DISABLE rows in `_smrt_feature_overrides` but
|
|
35
|
+
read them as an incident lever, not a flag: a global DISABLE wins over
|
|
36
|
+
everything, then the tenant's own DISABLE; ENABLE/INHERIT rows are
|
|
37
|
+
ignored, so "on" means no DISABLE row and enabling deletes it. Tenant rows
|
|
38
|
+
are written lower-cased and read in either spelling; enabling clears every
|
|
39
|
+
spelling. Reads are uncached. Kill-switch keys have no definition (so
|
|
40
|
+
`FeatureResolver` refuses them and `FeatureSettingsService` never lists
|
|
41
|
+
them). Keys belong to their consumer: `inference.hosted.enabled` is
|
|
42
|
+
smrt-inference's `HOSTED_INFERENCE_KILL_SWITCH`. `KillSwitchService.set()`
|
|
43
|
+
writes without an authorizer (the CLI's database credentials are the
|
|
44
|
+
authorization); admin UIs write through `FeatureOverrideService`.
|
|
22
45
|
|
|
23
46
|
## Conventions
|
|
24
47
|
|
package/README.md
CHANGED
|
@@ -59,8 +59,11 @@ accepts a s-m-r-t `SmartObjectManifest` containing class decorator metadata.
|
|
|
59
59
|
## Resolution
|
|
60
60
|
|
|
61
61
|
The resolver starts with the registered class's `defaultEnabled` (falling
|
|
62
|
-
back to the synced definition), then applies the
|
|
63
|
-
|
|
62
|
+
back to the synced definition), then applies the tenant's plan grant (see
|
|
63
|
+
below), the global override, and tenant overrides, in that order. Without a
|
|
64
|
+
tenant context, only the global override applies. `explain()` returns the
|
|
65
|
+
same answer as `isEnabled()` plus `decidedBy`, the layer that set it
|
|
66
|
+
(`default`, `plan_grant`, `global_override` or `tenant_override`).
|
|
64
67
|
|
|
65
68
|
The default hierarchy loader discovers `@happyvertical/smrt-users` when
|
|
66
69
|
available. Alternatively, supply `tenantHierarchyLoader` as the resolver's
|
|
@@ -68,9 +71,52 @@ second constructor argument; return a `FeatureTenantHierarchyProvider` or
|
|
|
68
71
|
`null` for flat tenant resolution. Hierarchy traversal runs root to leaf:
|
|
69
72
|
a child inherits its parent's state only when the parent has
|
|
70
73
|
`cascadePermissions` and the child has `inheritPermissions`; otherwise its
|
|
71
|
-
baseline resets to the global state
|
|
74
|
+
baseline resets to the global state (the plan grant with the global override
|
|
75
|
+
applied). Each tenant's own override then applies.
|
|
72
76
|
`inherit` preserves that baseline. Supported scopes are `global` and `tenant`.
|
|
73
77
|
|
|
78
|
+
## Plan grants and paid features
|
|
79
|
+
|
|
80
|
+
A tenant's subscription plan can grant feature keys. A granted key is on for
|
|
81
|
+
that tenant, and an ungranted key keeps its default. The global override then
|
|
82
|
+
applies on top: a global row is an explicit operator act, so a global DISABLE
|
|
83
|
+
stops the feature for every tenant, granted or not. Tenant overrides apply
|
|
84
|
+
last and beat both the grant and the global override. Features does not depend on
|
|
85
|
+
`@happyvertical/smrt-subscriptions`; it consults a `FeatureGrantSource`, and
|
|
86
|
+
with none registered (a local install) there are no grants.
|
|
87
|
+
|
|
88
|
+
The standard paid keys are exported as constants and all default off:
|
|
89
|
+
`FEATURE_SYNC_DEVICES`, `FEATURE_BACKUP_VAULT`, `FEATURE_CLOUD_HOSTED`,
|
|
90
|
+
`FEATURE_INFERENCE_HOSTED`, `FEATURE_PLUGINS_REMOTE`.
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { FEATURE_SYNC_DEVICES, FeatureResolver, featureGateResponse, requireFeature } from '@happyvertical/smrt-features';
|
|
94
|
+
import { SubscriptionFeatureSource } from '@happyvertical/smrt-subscriptions';
|
|
95
|
+
|
|
96
|
+
// Once per request.
|
|
97
|
+
const grantSource = await SubscriptionFeatureSource.create(dbOptions);
|
|
98
|
+
const resolver = new FeatureResolver(dbOptions);
|
|
99
|
+
|
|
100
|
+
// SvelteKit +server.ts: a structured 403 naming the key and the reason.
|
|
101
|
+
const denied = await featureGateResponse(FEATURE_SYNC_DEVICES, { resolver, tenantId, grantSource });
|
|
102
|
+
if (denied) return denied;
|
|
103
|
+
|
|
104
|
+
// Services: throws FeatureUnavailableError (status 403, .code, .denial, .toResponse()).
|
|
105
|
+
await requireFeature(FEATURE_SYNC_DEVICES, { resolver, tenantId, grantSource });
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
A denial body has `code: 'feature_upgrade_required'` with the `grantingPlan`
|
|
109
|
+
when the plan is what is missing, or `code: 'feature_disabled'` with
|
|
110
|
+
`disabledBy` (`global_override` or `tenant_override`) and no plan when an
|
|
111
|
+
override turned the feature off, since no upgrade would help.
|
|
112
|
+
|
|
113
|
+
The gate checks only that the feature is present for the tenant; authenticate
|
|
114
|
+
the caller and check its permissions first, and pass the tenant you verified.
|
|
115
|
+
Register an app-wide source with `setFeatureGrantSource()` instead of passing
|
|
116
|
+
one per call. `defineFrameworkFeature()` adds your own dotted keys, and
|
|
117
|
+
`FeatureSyncService.syncFrameworkDefinitions()` stores them for the settings
|
|
118
|
+
screen.
|
|
119
|
+
|
|
74
120
|
## Storage
|
|
75
121
|
|
|
76
122
|
- `_smrt_feature_definitions` — code-owned class identity, local id, boolean default, label, description, and metadata
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan grant source slot — dependency inversion between `smrt-features` and
|
|
3
|
+
* `smrt-subscriptions` (#4761).
|
|
4
|
+
*
|
|
5
|
+
* Features must keep working without subscription tables (local installs), so
|
|
6
|
+
* it never imports `smrt-subscriptions`. Instead a host (or
|
|
7
|
+
* `registerSubscriptionFeatureSource()` in `smrt-subscriptions`) registers a
|
|
8
|
+
* {@link FeatureGrantSource} here at setup, the same inversion core uses for
|
|
9
|
+
* `setDispatchTenantResolver()`. With no source registered the resolver sees
|
|
10
|
+
* no grants and behaves exactly as before.
|
|
11
|
+
*
|
|
12
|
+
* The slot lives on `globalThis` under a registered symbol so every module
|
|
13
|
+
* instance of either package (the monorepo can load a package from several
|
|
14
|
+
* paths) shares one source. The symbol key is a cross-package contract:
|
|
15
|
+
* `smrt-subscriptions` writes the same `Symbol.for()` key without importing
|
|
16
|
+
* this module. Do not rename it.
|
|
17
|
+
*/
|
|
18
|
+
import type { FeatureGrantSource } from './types.js';
|
|
19
|
+
/** `Symbol.for()` key of the global grant source slot. Do not rename. */
|
|
20
|
+
export declare const FEATURE_GRANT_SOURCE_SLOT_KEY = "@happyvertical/smrt-features:grant-source";
|
|
21
|
+
/**
|
|
22
|
+
* Register the process-wide grant source, or clear it with `undefined`.
|
|
23
|
+
*
|
|
24
|
+
* Register a source whose lookups are safe to share across requests (one
|
|
25
|
+
* app-lifetime `SubscriptionResolver`, no per-tenant memo). For per-request
|
|
26
|
+
* memoization pass a request-scoped source as `context.grantSource` instead.
|
|
27
|
+
*/
|
|
28
|
+
export declare function setFeatureGrantSource(source: FeatureGrantSource | undefined): void;
|
|
29
|
+
/** The registered process-wide grant source, if any. */
|
|
30
|
+
export declare function getFeatureGrantSource(): FeatureGrantSource | undefined;
|
|
31
|
+
//# sourceMappingURL=feature-grants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-grants.d.ts","sourceRoot":"","sources":["../src/feature-grants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,8CACG,CAAC;AAM9C;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,IAAI,CAEN;AAED,wDAAwD;AACxD,wBAAgB,qBAAqB,IAAI,kBAAkB,GAAG,SAAS,CAEtE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type FeatureHostOptions } from './list-bounds.js';
|
|
2
|
-
import { type FeatureResolutionContext, type FeatureResolverOptions, type FeatureTargetConstructor } from './types.js';
|
|
2
|
+
import { type FeatureGrantingPlan, type FeatureResolution, type FeatureResolutionContext, type FeatureResolverOptions, type FeatureTargetConstructor } from './types.js';
|
|
3
3
|
export declare class FeatureResolver {
|
|
4
4
|
private readonly options;
|
|
5
5
|
private readonly resolverOptions;
|
|
@@ -9,7 +9,26 @@ export declare class FeatureResolver {
|
|
|
9
9
|
private tenantHierarchyPromise;
|
|
10
10
|
constructor(options?: FeatureHostOptions, resolverOptions?: FeatureResolverOptions);
|
|
11
11
|
isEnabled(featureKey: string, context?: FeatureResolutionContext): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve `featureKey` and report which layer decided the result: the code
|
|
14
|
+
* default, a plan grant, the global override, or a tenant override.
|
|
15
|
+
*
|
|
16
|
+
* Layers apply low → high: code default, plan grant (a granted key becomes
|
|
17
|
+
* enabled), global override, tenant ancestor chain, the tenant's own
|
|
18
|
+
* override. The global override sits above plan grants because it is an
|
|
19
|
+
* explicit operator act: a global DISABLE stops the feature fleet-wide,
|
|
20
|
+
* granted tenants included. Tenant overrides still win over everything.
|
|
21
|
+
* Without a tenant context only the default and the global override apply.
|
|
22
|
+
*/
|
|
23
|
+
explain(featureKey: string, context?: FeatureResolutionContext): Promise<FeatureResolution>;
|
|
12
24
|
isEnabledFor(classOrInstance: object | FeatureTargetConstructor, localId: string, context?: FeatureResolutionContext): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
* The plan that grants `featureKey`, for an upgrade response; `null` when
|
|
27
|
+
* no grant source is available or no visible plan grants it.
|
|
28
|
+
*/
|
|
29
|
+
findGrantingPlan(featureKey: string, context?: FeatureResolutionContext): Promise<FeatureGrantingPlan | null>;
|
|
30
|
+
private grantSourceFor;
|
|
31
|
+
private isGranted;
|
|
13
32
|
private ensureInitialized;
|
|
14
33
|
private resolveBaseState;
|
|
15
34
|
private applyOverride;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-resolver.d.ts","sourceRoot":"","sources":["../src/feature-resolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature-resolver.d.ts","sourceRoot":"","sources":["../src/feature-resolver.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAI9B,MAAM,YAAY,CAAC;AAMpB,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,qBAAqB,CAA8B;IAC3D,OAAO,CAAC,sBAAsB,CACvB;gBAGL,OAAO,GAAE,kBAAuB,EAChC,eAAe,GAAE,sBAA2B;IAMxC,SAAS,CACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,OAAO,CAAC;IAInB;;;;;;;;;;OAUG;IACG,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,iBAAiB,CAAC;IAuFvB,YAAY,CAChB,eAAe,EAAE,MAAM,GAAG,wBAAwB,EAClD,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,OAAO,CAAC;IAKnB;;;OAGG;IACG,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IAQtC,OAAO,CAAC,cAAc;YAYR,SAAS;YAYT,iBAAiB;YAiBjB,gBAAgB;IA0B9B,OAAO,CAAC,aAAa;YAeP,kBAAkB;CAUjC"}
|
package/dist/feature-sync.d.ts
CHANGED
|
@@ -8,6 +8,14 @@ export declare class FeatureSyncService {
|
|
|
8
8
|
constructor(options?: FeatureHostOptions);
|
|
9
9
|
syncDefinitions(options?: SyncDefinitionsOptions): Promise<FeatureSyncResult>;
|
|
10
10
|
syncManifest(manifest: SmartObjectManifest, options?: SyncManifestOptions): Promise<FeatureSyncResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Mirror framework feature definitions (the standard paid keys and any
|
|
13
|
+
* `defineFrameworkFeature()` registrations, #4761) into
|
|
14
|
+
* `_smrt_feature_definitions` so the settings screen can list and override
|
|
15
|
+
* them. Framework rows have an empty `qualifiedClassName`; this method only
|
|
16
|
+
* upserts them and class syncs never prune them.
|
|
17
|
+
*/
|
|
18
|
+
syncFrameworkDefinitions(): Promise<FeatureSyncResult>;
|
|
11
19
|
private ensureInitialized;
|
|
12
20
|
private collectDefinitionsFromRegistrations;
|
|
13
21
|
private collectTouchedPackagesFromRegistrations;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-sync.d.ts","sourceRoot":"","sources":["../src/feature-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"feature-sync.d.ts","sourceRoot":"","sources":["../src/feature-sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,KAAK,kBAAkB,EAAqB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,KAAK,EAEV,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AASpB,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,kBAAkB,CAA+B;IACzD,OAAO,CAAC,qBAAqB,CAA8B;gBAE/C,OAAO,GAAE,kBAAuB;IAItC,eAAe,CACnB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,iBAAiB,CAAC;IAcvB,YAAY,CAChB,QAAQ,EAAE,mBAAmB,EAC7B,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;IAW7B;;;;;;OAMG;IACG,wBAAwB,IAAI,OAAO,CAAC,iBAAiB,CAAC;YAkB9C,iBAAiB;IAe/B,OAAO,CAAC,mCAAmC;IAY3C,OAAO,CAAC,uCAAuC;IAmB/C,OAAO,CAAC,oBAAoB;YA6Bd,gBAAgB;CA8D/B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FeatureMetadata } from './types.js';
|
|
2
|
+
export interface FrameworkFeatureDefinition {
|
|
3
|
+
/** Dotted key, e.g. `inference.hosted`. Persisted; never rename. */
|
|
4
|
+
featureKey: string;
|
|
5
|
+
/** Package that owns the definition (used for sync ownership). */
|
|
6
|
+
packageName: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
defaultEnabled: boolean;
|
|
10
|
+
/** Free-form metadata; paid keys carry `paid: true`. */
|
|
11
|
+
metadata?: FeatureMetadata & {
|
|
12
|
+
paid?: boolean;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Whether `featureKey` has the framework (dotted) key shape. */
|
|
16
|
+
export declare function isFrameworkFeatureKey(featureKey: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Register a framework feature definition. Re-registering an identical
|
|
19
|
+
* definition is a no-op (module instances may load twice); a conflicting one
|
|
20
|
+
* throws, because the key is a persisted identifier with one meaning.
|
|
21
|
+
*/
|
|
22
|
+
export declare function defineFrameworkFeature(definition: FrameworkFeatureDefinition): FrameworkFeatureDefinition;
|
|
23
|
+
/** The framework definition for `featureKey`, if registered. */
|
|
24
|
+
export declare function getFrameworkFeature(featureKey: string): FrameworkFeatureDefinition | undefined;
|
|
25
|
+
/** Every registered framework definition, standard keys included. */
|
|
26
|
+
export declare function listFrameworkFeatures(): FrameworkFeatureDefinition[];
|
|
27
|
+
//# sourceMappingURL=framework-features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework-features.d.ts","sourceRoot":"","sources":["../src/framework-features.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,UAAU,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC;IACxB,wDAAwD;IACxD,QAAQ,CAAC,EAAE,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACjD;AA0BD,iEAAiE;AACjE,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,0BAA0B,GACrC,0BAA0B,CA6B5B;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,GACjB,0BAA0B,GAAG,SAAS,CAExC;AAED,qEAAqE;AACrE,wBAAgB,qBAAqB,IAAI,0BAA0B,EAAE,CAEpE"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,17 @@
|
|
|
8
8
|
import './__smrt-register__.js';
|
|
9
9
|
export { FeatureDefinition } from './feature-definition.js';
|
|
10
10
|
export { FeatureDefinitionCollection } from './feature-definitions.js';
|
|
11
|
+
export { FEATURE_GRANT_SOURCE_SLOT_KEY, getFeatureGrantSource, setFeatureGrantSource, } from './feature-grants.js';
|
|
11
12
|
export { FeatureOverride } from './feature-override.js';
|
|
12
13
|
export { FeatureOverrideAuthorizationError, type FeatureOverrideAuthorizer, FeatureOverrideService, type FeatureOverrideWriteRequest, } from './feature-override-service.js';
|
|
13
14
|
export { FeatureOverrideCollection } from './feature-overrides.js';
|
|
14
15
|
export { FeatureResolver } from './feature-resolver.js';
|
|
15
16
|
export { type FeatureSettingsRow, FeatureSettingsService, type FeatureSettingsServiceOptions, featureOverrideEffectFromValue, InvalidFeatureScopeError, type ListFeatureSettingsOptions, type SetFeatureOverrideRequest, UnknownFeatureKeyError, } from './feature-settings.js';
|
|
16
17
|
export { FeatureSyncService } from './feature-sync.js';
|
|
17
|
-
export {
|
|
18
|
+
export { defineFrameworkFeature, type FrameworkFeatureDefinition, getFrameworkFeature, isFrameworkFeatureKey, listFrameworkFeatures, } from './framework-features.js';
|
|
19
|
+
export { KillSwitchService, type KillSwitchState, readKillSwitch, setKillSwitch, } from './kill-switch.js';
|
|
20
|
+
export { checkFeature, FEATURE_DISABLED_CODE, FEATURE_GATE_STATUS, FEATURE_UPGRADE_REQUIRED_CODE, type FeatureDisabled, type FeatureGateDenial, type FeatureGateOptions, type FeatureGateResult, FeatureUnavailableError, type FeatureUpgradeRequired, featureDenialResponse, featureGateResponse, requireFeature, } from './require-feature.js';
|
|
21
|
+
export { FEATURE_BACKUP_VAULT, FEATURE_CLOUD_HOSTED, FEATURE_INFERENCE_HOSTED, FEATURE_PLUGINS_REMOTE, FEATURE_SYNC_DEVICES, STANDARD_FEATURE_KEYS, STANDARD_FEATURES, type StandardFeatureKey, } from './standard-features.js';
|
|
22
|
+
export { type FeatureDecisionLayer, type FeatureDefinitionOptions, type FeatureDefinitionSeed, type FeatureGrantingPlan, type FeatureGrantSnapshot, type FeatureGrantSource, type FeatureMetadata, FeatureOverrideEffect, type FeatureOverrideOptions, type FeatureResolution, type FeatureResolutionContext, type FeatureResolverOptions, type FeatureScopeType, type FeatureSyncResult, type FeatureTenantHierarchyLoader, type FeatureTenantHierarchyProvider, type FeatureTenantNode, type FeatureUsersModule, GLOBAL_FEATURE_SCOPE_ID, type SyncDefinitionsOptions, type SyncManifestOptions, } from './types.js';
|
|
18
23
|
export { createFeatureKey, findFeatureDefaultInRegistry, parseFeatureKey, resolveFeatureKeyForTarget, } from './utils.js';
|
|
19
24
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,iCAAiC,EACjC,KAAK,yBAAyB,EAC9B,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,eAAe,EAA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