@authup/access 1.0.0-beta.49 → 1.0.0-beta.51
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/index.d.mts +138 -15
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +252 -47
- package/dist/index.mjs.map +1 -1
- package/dist/permission/evaluator/module.d.ts +2 -2
- package/dist/permission/evaluator/module.d.ts.map +1 -1
- package/dist/permission/evaluator/types.d.ts +1 -1
- package/dist/permission/evaluator/types.d.ts.map +1 -1
- package/dist/permission/helpers/aggregate.d.ts +10 -0
- package/dist/permission/helpers/aggregate.d.ts.map +1 -0
- package/dist/permission/helpers/equal.d.ts +6 -2
- package/dist/permission/helpers/equal.d.ts.map +1 -1
- package/dist/permission/helpers/grant.d.ts +9 -0
- package/dist/permission/helpers/grant.d.ts.map +1 -0
- package/dist/permission/helpers/index.d.ts +2 -1
- package/dist/permission/helpers/index.d.ts.map +1 -1
- package/dist/permission/index.d.ts +1 -0
- package/dist/permission/index.d.ts.map +1 -1
- package/dist/permission/provider/memory.d.ts +3 -3
- package/dist/permission/provider/memory.d.ts.map +1 -1
- package/dist/permission/provider/types.d.ts +2 -2
- package/dist/permission/provider/types.d.ts.map +1 -1
- package/dist/permission/realm-scope/constants.d.ts +20 -0
- package/dist/permission/realm-scope/constants.d.ts.map +1 -0
- package/dist/permission/realm-scope/helpers.d.ts +23 -0
- package/dist/permission/realm-scope/helpers.d.ts.map +1 -0
- package/dist/permission/realm-scope/index.d.ts +3 -0
- package/dist/permission/realm-scope/index.d.ts.map +1 -0
- package/dist/permission/types.d.ts +37 -0
- package/dist/permission/types.d.ts.map +1 -1
- package/dist/policy/built-in/constants.d.ts +0 -2
- package/dist/policy/built-in/constants.d.ts.map +1 -1
- package/dist/policy/built-in/realm-match/evaluator.d.ts.map +1 -1
- package/dist/policy/built-in/realm-match/types.d.ts +6 -3
- package/dist/policy/built-in/realm-match/types.d.ts.map +1 -1
- package/dist/policy/built-in/realm-match/validator.d.ts.map +1 -1
- package/dist/policy/index.d.ts +1 -0
- package/dist/policy/index.d.ts.map +1 -1
- package/dist/policy/input.d.ts +26 -0
- package/dist/policy/input.d.ts.map +1 -0
- package/package.json +7 -11
- package/dist/permission/helpers/merge.d.ts +0 -3
- package/dist/permission/helpers/merge.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/equal.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"equal.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/equal.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,wBAAgB,8BAA8B,CAC1C,CAAC,EAAE;IAAE,UAAU,EAAE,cAAc,CAAA;CAAE,EACjC,CAAC,EAAE;IAAE,UAAU,EAAE,cAAc,CAAA;CAAE,GAClC,OAAO,CAcT"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PermissionGrant } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Whether the actor's `parent` grant covers the target's `child` grant: it reaches at least as
|
|
4
|
+
* far (ordered none < own < ownOrNull < any) AND its policy provably covers the child's
|
|
5
|
+
* (see `policyDominates`). Used per grant by `isSuperset` over the aggregated disjunction —
|
|
6
|
+
* every child grant must be dominated by SOME parent grant.
|
|
7
|
+
*/
|
|
8
|
+
export declare function grantDominates(parent: PermissionGrant, child: PermissionGrant): boolean;
|
|
9
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/grant.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AA2GhD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAMvF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/permission/index.ts"],"names":[],"mappings":"AAOA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PermissionPolicyBinding } from '../types';
|
|
1
|
+
import type { PermissionPolicyBinding, PermissionPolicyBindingAggregated } from '../types';
|
|
2
2
|
import type { IPermissionProvider, PermissionGetOptions } from './types';
|
|
3
3
|
export declare class PermissionMemoryProvider implements IPermissionProvider {
|
|
4
|
-
protected items: Record<string,
|
|
4
|
+
protected items: Record<string, PermissionPolicyBindingAggregated>;
|
|
5
5
|
constructor(items?: PermissionPolicyBinding[]);
|
|
6
|
-
findOne(options: PermissionGetOptions): Promise<
|
|
6
|
+
findOne(options: PermissionGetOptions): Promise<PermissionPolicyBindingAggregated | null>;
|
|
7
7
|
setMany(input: PermissionPolicyBinding[]): void;
|
|
8
8
|
}
|
|
9
9
|
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/memory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/memory.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEzE,qBAAa,wBAAyB,YAAW,mBAAmB;IAChE,SAAS,CAAC,KAAK,EAAG,MAAM,CAAC,MAAM,EAAE,iCAAiC,CAAC,CAAM;gBAE7D,KAAK,GAAE,uBAAuB,EAAO;IAI3C,OAAO,CACT,OAAO,EAAE,oBAAoB,GAC9B,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC;IAepD,OAAO,CAAC,KAAK,EAAE,uBAAuB,EAAE;CAQ3C"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PermissionPolicyBindingAggregated } from '../types';
|
|
2
2
|
export type PermissionGetOptions = {
|
|
3
3
|
name: string;
|
|
4
4
|
clientId?: string | null;
|
|
5
5
|
realmId?: string | null;
|
|
6
6
|
};
|
|
7
7
|
export interface IPermissionProvider {
|
|
8
|
-
findOne(criteria: PermissionGetOptions): Promise<
|
|
8
|
+
findOne(criteria: PermissionGetOptions): Promise<PermissionPolicyBindingAggregated | null>;
|
|
9
9
|
}
|
|
10
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/provider/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,MAAM,oBAAoB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC1B,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAChC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAI,OAAO,CAAC,iCAAiC,GAAG,IAAI,CAAC,CAAC;CAC/F"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor-relative realm reach of a permission grant.
|
|
3
|
+
*
|
|
4
|
+
* Total order (least -> most permissive): none < own < ownOrNull < any.
|
|
5
|
+
* A missing/unknown column coerces to `own` (fail-closed); `none` is only ever an
|
|
6
|
+
* explicit value (the grant reaches no realm at all).
|
|
7
|
+
*/
|
|
8
|
+
export declare enum RealmScope {
|
|
9
|
+
/** No reach — the grant matches no resource realm. */
|
|
10
|
+
NONE = "none",
|
|
11
|
+
/** Own realm only — resource realm must equal the actor's realm. */
|
|
12
|
+
OWN = "own",
|
|
13
|
+
/** Own realm or null/global resources (realm_id === null). */
|
|
14
|
+
OWN_OR_NULL = "ownOrNull",
|
|
15
|
+
/** Any realm, including null/global. */
|
|
16
|
+
ANY = "any"
|
|
17
|
+
}
|
|
18
|
+
/** Numeric restrictiveness order — internal to the fold/compare helpers. */
|
|
19
|
+
export declare const REALM_SCOPE_ORDER: Record<`${RealmScope}`, number>;
|
|
20
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/permission/realm-scope/constants.ts"],"names":[],"mappings":"AAOA;;;;;;GAMG;AACH,oBAAY,UAAU;IAClB,sDAAsD;IACtD,IAAI,SAAS;IACb,oEAAoE;IACpE,GAAG,QAAQ;IACX,8DAA8D;IAC9D,WAAW,cAAc;IACzB,wCAAwC;IACxC,GAAG,QAAQ;CACd;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,GAAG,UAAU,EAAE,EAAE,MAAM,CAK7D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RealmScope } from './constants';
|
|
2
|
+
/**
|
|
3
|
+
* Coerce an arbitrary value to a RealmScope, defaulting to `own` for missing /
|
|
4
|
+
* null / unknown input (fail-closed). `none` is honoured only when explicit.
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeRealmScope(value?: `${RealmScope}` | null): `${RealmScope}`;
|
|
7
|
+
/**
|
|
8
|
+
* Numeric comparison of two realm scopes by restrictiveness.
|
|
9
|
+
* Negative when `a` is more restrictive than `b`, positive when less.
|
|
10
|
+
*/
|
|
11
|
+
export declare function compareRealmScope(a?: `${RealmScope}` | null, b?: `${RealmScope}` | null): number;
|
|
12
|
+
/** Fold scopes to the MOST permissive (ordered max). Empty folds to `own`. */
|
|
13
|
+
export declare function maxRealmScope(values: Array<`${RealmScope}` | null | undefined>): `${RealmScope}`;
|
|
14
|
+
/** Fold scopes to the MORE restrictive (ordered min) — used to CAP a grant. Empty folds to `own`. */
|
|
15
|
+
export declare function minRealmScope(values: Array<`${RealmScope}` | null | undefined>): `${RealmScope}`;
|
|
16
|
+
/**
|
|
17
|
+
* Whether `scope` reaches the resource. The resource realm may be presented as a single
|
|
18
|
+
* id, `null` (global), or an array of realm ids — the array form (a resource that spans
|
|
19
|
+
* multiple realms) requires the scope to reach EVERY listed realm (unanimous, fail-closed),
|
|
20
|
+
* so any app/entity can express its realm via one or many keys under the canonical contract.
|
|
21
|
+
*/
|
|
22
|
+
export declare function realmScopeMatches(scope: `${RealmScope}` | null | undefined, resourceRealmId: string | string[] | null | undefined, identityRealmId: string | null | undefined, identityRealmName?: string | null): boolean;
|
|
23
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/permission/realm-scope/helpers.ts"],"names":[],"mappings":"AAOA,OAAO,EAAqB,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,GAAG,UAAU,EAAE,CAMnF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC7B,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,EAC1B,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,GAC3B,MAAM,CAER;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,GAAG,UAAU,EAAE,CAYhG;AAED,qGAAqG;AACrG,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,GAAG,UAAU,EAAE,CAWhG;AAwBD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC7B,KAAK,EAAE,GAAG,UAAU,EAAE,GAAG,IAAI,GAAG,SAAS,EACzC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,GAAG,SAAS,EACrD,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC1C,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,GAClC,OAAO,CAyBT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/realm-scope/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -1,13 +1,50 @@
|
|
|
1
1
|
import type { BasePolicy } from '../policy';
|
|
2
2
|
import type { DecisionStrategy } from '@authup/kit';
|
|
3
|
+
import type { RealmScope } from './realm-scope';
|
|
3
4
|
export type BasePermission = {
|
|
4
5
|
name: string;
|
|
5
6
|
client_id?: string | null;
|
|
6
7
|
realm_id?: string | null;
|
|
7
8
|
decision_strategy?: `${DecisionStrategy}` | null;
|
|
8
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* A raw permission grant: one permission with its policies and realm reach, as loaded from a
|
|
12
|
+
* role/identity junction. `aggregatePermissionPolicyBindings` groups these per permission into
|
|
13
|
+
* a `PermissionPolicyBindingAggregated` (the lossless disjunction of grants).
|
|
14
|
+
*/
|
|
9
15
|
export type PermissionPolicyBinding = {
|
|
10
16
|
permission: BasePermission;
|
|
11
17
|
policies?: BasePolicy[];
|
|
18
|
+
/**
|
|
19
|
+
* Relative realm reach of this grant (none/own/ownOrNull/any). Absent coerces to the
|
|
20
|
+
* most restrictive `own` (fail-closed). NOT part of the binding identity key
|
|
21
|
+
* (see isPermissionPolicyBindingEqual).
|
|
22
|
+
*/
|
|
23
|
+
realm_scope?: `${RealmScope}`;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One disjunction term of an aggregated binding: a single grant's realm reach paired with its
|
|
27
|
+
* own (single) policy. A disjunction-aware consumer ORs `realmScopeMatches(realm_scope) ∧ policy`
|
|
28
|
+
* across the grants of a permission.
|
|
29
|
+
*/
|
|
30
|
+
export type PermissionGrant = {
|
|
31
|
+
/** Relative realm reach (none/own/ownOrNull/any), normalized — fail-closed default `own`. */
|
|
32
|
+
realm_scope: `${RealmScope}`;
|
|
33
|
+
/**
|
|
34
|
+
* The grant's policy: the raw junction policy (its `id` preserved, for propagation) for a
|
|
35
|
+
* single-policy grant, a composite for a multi-policy (Layer-1) binding, or `undefined`
|
|
36
|
+
* when the grant carries no restriction.
|
|
37
|
+
*/
|
|
38
|
+
policy?: BasePolicy;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* A permission together with the actor's disjunction of grants for it. Output of
|
|
42
|
+
* `aggregatePermissionPolicyBindings` — the honest, lossless replacement for the collapsed
|
|
43
|
+
* `PermissionPolicyBinding` (no top-level realm_scope/policies; the access decision is the
|
|
44
|
+
* OR over `grants`).
|
|
45
|
+
*/
|
|
46
|
+
export type PermissionPolicyBindingAggregated = {
|
|
47
|
+
permission: BasePermission;
|
|
48
|
+
grants: PermissionGrant[];
|
|
12
49
|
};
|
|
13
50
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/permission/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,GAAG,IAAI,CAAA;CACnD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IAClC,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,UAAU,EAAE,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,GAAG,UAAU,EAAE,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,6FAA6F;IAC7F,WAAW,EAAE,GAAG,UAAU,EAAE,CAAC;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,eAAe,EAAE,CAAC;CAC7B,CAAC"}
|
|
@@ -37,8 +37,6 @@ export declare const SystemPolicyName: {
|
|
|
37
37
|
readonly IDENTITY: "system.identity";
|
|
38
38
|
readonly PERMISSION_BINDING: "system.permission-binding";
|
|
39
39
|
readonly REALM_MATCH: "system.realm-match";
|
|
40
|
-
readonly REALM_BOUND: "system.realm-bound";
|
|
41
|
-
readonly REALM_OR_GLOBAL: "system.realm-or-global";
|
|
42
40
|
readonly CLIENT_NAMES_SELF_MANAGE: "system.client-names-self-manage";
|
|
43
41
|
readonly ROBOT_NAMES_SELF_MANAGE: "system.robot-names-self-manage";
|
|
44
42
|
readonly USER_NAMES_SELF_MANAGE: "system.user-names-self-manage";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,eAAe,mBAAmB;IAClC;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,WAAW,eAAe;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,kBAAkB,sBAAsB;CAI3C;AAED,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/policy/built-in/constants.ts"],"names":[],"mappings":"AAOA,oBAAY,iBAAiB;IACzB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,IAAI,SAAS;IACb;;OAEG;IACH,eAAe,mBAAmB;IAClC;;OAEG;IACH,UAAU,eAAe;IACzB;;OAEG;IACH,WAAW,eAAe;IAE1B;;OAEG;IACH,QAAQ,aAAa;IAErB;;OAEG;IACH,kBAAkB,sBAAsB;CAI3C;AAED,eAAO,MAAM,gBAAgB;;;;;;;;CAQnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/evaluator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/evaluator.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAG1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,yBAA0B,YAAW,gBAAgB;IAC9D,SAAS,CAAC,SAAS,EAAG,yBAAyB,CAAC;IAEhD,SAAS,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;IAErD,SAAS,CAAC,mBAAmB,EAAG,yBAAyB,CAAC;;IAQpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC;CA2J5G"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DecisionStrategy } from '@authup/kit';
|
|
2
|
+
import type { RealmScope } from '../../../permission/realm-scope';
|
|
2
3
|
import type { BasePolicy } from '../../types';
|
|
3
4
|
export interface RealmMatchPolicy extends BasePolicy {
|
|
4
5
|
/**
|
|
@@ -20,9 +21,11 @@ export interface RealmMatchPolicy extends BasePolicy {
|
|
|
20
21
|
*/
|
|
21
22
|
attribute_null_match_all?: boolean;
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* Coarse, actor-relative realm reach (none/own/ownOrNull/any). When set, the evaluator
|
|
25
|
+
* runs in SCOPE MODE: it matches the resource realm read from the REALM_MATCH data key
|
|
26
|
+
* against the identity realm via `realmScopeMatches`, and ignores `attribute_name` /
|
|
27
|
+
* `attribute_null_match_all`. With no REALM_MATCH key present it neutral-passes.
|
|
25
28
|
*/
|
|
26
|
-
|
|
29
|
+
scope?: `${RealmScope}`;
|
|
27
30
|
}
|
|
28
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD;;OAEG;IACH,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEnC;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAChD;;OAEG;IACH,iBAAiB,CAAC,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE1C;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEnC;;OAEG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAEnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,GAAG,UAAU,EAAE,CAAA;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../../src/policy/built-in/realm-match/validator.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,qBAAa,yBAA0B,SAAQ,SAAS,CAAC,gBAAgB,CAAC;IAC7D,UAAU;CA+DtB"}
|
package/dist/policy/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/policy/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BuiltInPolicyType } from './built-in/constants';
|
|
2
|
+
import type { IdentityPolicyData } from './built-in/identity/types';
|
|
3
|
+
import { PolicyData } from './data';
|
|
4
|
+
/**
|
|
5
|
+
* Typed seed for a permission evaluation's {@link PolicyData} bag.
|
|
6
|
+
*
|
|
7
|
+
* The well-known context keys are value-typed, so construction is discoverable and a
|
|
8
|
+
* wrong-typed value is a compile error. The trailing index signature keeps the bag **open** —
|
|
9
|
+
* a third-party evaluator may supply its own key without any change to this published type
|
|
10
|
+
* (the `access` evaluator set is deliberately extensible).
|
|
11
|
+
*/
|
|
12
|
+
export interface PolicyInput {
|
|
13
|
+
[BuiltInPolicyType.IDENTITY]?: IdentityPolicyData;
|
|
14
|
+
[BuiltInPolicyType.ATTRIBUTES]?: Record<string, any>;
|
|
15
|
+
[BuiltInPolicyType.REALM_MATCH]?: string | string[] | null;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Build a {@link PolicyData} bag from a typed {@link PolicyInput} seed. Well-known keys
|
|
20
|
+
* (identity / attributes / realmMatch) are type-checked; unknown keys are accepted as-is.
|
|
21
|
+
*
|
|
22
|
+
* Prefer this over `new PolicyData({ ... })` at construction sites so the key vocabulary and
|
|
23
|
+
* per-key value types live in one place.
|
|
24
|
+
*/
|
|
25
|
+
export declare function definePolicyData(input?: PolicyInput): PolicyData;
|
|
26
|
+
//# sourceMappingURL=input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/policy/input.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,EAAE,kBAAkB,CAAC;IAClD,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrD,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;IAC3D,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,GAAE,WAAgB,GAAG,UAAU,CAEpE"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authup/access",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
4
|
+
"version": "1.0.0-beta.51",
|
|
5
5
|
"description": "A library for evaluating permissions and policies.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"exports": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test:coverage": "cross-env NODE_ENV=test vitest run --coverage"
|
|
25
25
|
},
|
|
26
26
|
"engines": {
|
|
27
|
-
"node": "^
|
|
27
|
+
"node": "^22.13.0 || ^23.5.0 || >=24.0.0"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"auth",
|
|
@@ -53,22 +53,18 @@
|
|
|
53
53
|
},
|
|
54
54
|
"homepage": "https://github.com/authup/authup#readme",
|
|
55
55
|
"dependencies": {
|
|
56
|
+
"@authup/errors": "^1.0.0-beta.51",
|
|
57
|
+
"@authup/kit": "^1.0.0-beta.51",
|
|
56
58
|
"@ucast/mongo2js": "^2.0.0",
|
|
57
|
-
"
|
|
59
|
+
"@validup/zod": "^0.3.3",
|
|
60
|
+
"smob": "^1.6.1",
|
|
58
61
|
"validup": "^0.5.1",
|
|
59
|
-
"zod": "^4.4.3"
|
|
60
|
-
"@validup/zod": "^0.3.3"
|
|
62
|
+
"zod": "^4.4.3"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
|
-
"@authup/errors": "^1.0.0-beta.49",
|
|
64
|
-
"@authup/kit": "^1.0.0-beta.49",
|
|
65
65
|
"unplugin-swc": "^1.5.9",
|
|
66
66
|
"vitest": "^4.0.14"
|
|
67
67
|
},
|
|
68
|
-
"peerDependencies": {
|
|
69
|
-
"@authup/errors": "^1.0.0-beta.49",
|
|
70
|
-
"@authup/kit": "^1.0.0-beta.49"
|
|
71
|
-
},
|
|
72
68
|
"publishConfig": {
|
|
73
69
|
"access": "public"
|
|
74
70
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/permission/helpers/merge.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAQxD,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,uBAAuB,EAAE,GAAI,uBAAuB,EAAE,CAiE1G"}
|