@authup/access 1.0.0-beta.65 → 1.0.0-beta.67
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 +557 -65
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +838 -30
- package/dist/index.mjs.map +1 -1
- package/dist/permission/authorization/check-schema.d.ts +23 -0
- package/dist/permission/authorization/check-schema.d.ts.map +1 -0
- package/dist/permission/authorization/check.d.ts +7 -0
- package/dist/permission/authorization/check.d.ts.map +1 -0
- package/dist/permission/authorization/constants.d.ts +14 -0
- package/dist/permission/authorization/constants.d.ts.map +1 -0
- package/dist/permission/authorization/error.d.ts +18 -0
- package/dist/permission/authorization/error.d.ts.map +1 -0
- package/dist/permission/authorization/index.d.ts +9 -0
- package/dist/permission/authorization/index.d.ts.map +1 -0
- package/dist/permission/authorization/module.d.ts +77 -0
- package/dist/permission/authorization/module.d.ts.map +1 -0
- package/dist/permission/authorization/policy.d.ts +31 -0
- package/dist/permission/authorization/policy.d.ts.map +1 -0
- package/dist/permission/authorization/schema.d.ts +107 -0
- package/dist/permission/authorization/schema.d.ts.map +1 -0
- package/dist/permission/authorization/types.d.ts +136 -0
- package/dist/permission/authorization/types.d.ts.map +1 -0
- package/dist/permission/evaluator/module.d.ts.map +1 -1
- package/dist/permission/evaluator/types.d.ts +16 -1
- package/dist/permission/evaluator/types.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/realm-scope/helpers.d.ts +1 -1
- package/dist/permission/realm-scope/helpers.d.ts.map +1 -1
- package/dist/policy/built-in/date/evaluator.d.ts.map +1 -1
- package/dist/policy/built-in/permission-binding/identity-evaluator.d.ts +21 -0
- package/dist/policy/built-in/permission-binding/identity-evaluator.d.ts.map +1 -0
- package/dist/policy/built-in/permission-binding/index.d.ts +1 -0
- package/dist/policy/built-in/permission-binding/index.d.ts.map +1 -1
- package/dist/policy/built-in/permission-binding/validator.d.ts.map +1 -1
- package/dist/policy/built-in/time/evaluator.d.ts.map +1 -1
- package/dist/policy/constants.d.ts +11 -0
- package/dist/policy/constants.d.ts.map +1 -1
- package/dist/policy/data.d.ts +2 -0
- package/dist/policy/data.d.ts.map +1 -1
- package/dist/policy/evaluation/context/define.d.ts.map +1 -1
- package/dist/policy/evaluation/context/index.d.ts +1 -0
- package/dist/policy/evaluation/context/index.d.ts.map +1 -1
- package/dist/policy/evaluation/context/transition.d.ts +13 -0
- package/dist/policy/evaluation/context/transition.d.ts.map +1 -0
- package/dist/policy/evaluation/context/types.d.ts +27 -0
- package/dist/policy/evaluation/context/types.d.ts.map +1 -1
- package/dist/policy/types.d.ts +5 -0
- package/dist/policy/types.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AttributeNamesPolicyEvaluator, AttributesPolicyEvaluator, CompositePolicyEvaluator, DatePolicyEvaluator, IdentityPolicyEvaluator, PermissionBindingPolicyEvaluator, RealmMatchPolicyEvaluator, TimePolicyEvaluator } from './built-in';
|
|
2
|
+
import type { PolicyValidators } from './types.ts';
|
|
2
3
|
export declare const PolicyDefaultEvaluators: {
|
|
3
4
|
readonly composite: CompositePolicyEvaluator;
|
|
4
5
|
readonly attributes: AttributesPolicyEvaluator<Record<string, any>>;
|
|
@@ -9,4 +10,14 @@ export declare const PolicyDefaultEvaluators: {
|
|
|
9
10
|
readonly realmMatch: RealmMatchPolicyEvaluator;
|
|
10
11
|
readonly time: TimePolicyEvaluator;
|
|
11
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The configuration validator of every built-in policy type, keyed like
|
|
15
|
+
* `PolicyDefaultEvaluators`. It is what `projectAuthorizationPolicy` runs a
|
|
16
|
+
* node through, so a type absent here cannot travel in the authorization
|
|
17
|
+
* catalog. The registry is open like the evaluator one (#3635): spread it and
|
|
18
|
+
* add a custom type's validator to let that type travel. It is frozen, since
|
|
19
|
+
* a write into it would make the type projectable for every caller in the
|
|
20
|
+
* process.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PolicyDefaultValidators: Readonly<PolicyValidators>;
|
|
12
23
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/policy/constants.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,6BAA6B,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/policy/constants.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,6BAA6B,EAE7B,yBAAyB,EAGzB,wBAAwB,EAExB,mBAAmB,EAEnB,uBAAuB,EAEvB,gCAAgC,EAEhC,yBAAyB,EAEzB,mBAAmB,EAEtB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,eAAO,MAAM,uBAAuB;;;;;;;;;CAS1B,CAAC;AAEX;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAG,QAAQ,CAAC,gBAAgB,CAS9D,CAAC"}
|
package/dist/policy/data.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export interface IPolicyData {
|
|
|
2
2
|
set(key: string, value: unknown): void;
|
|
3
3
|
has(key: string): boolean;
|
|
4
4
|
get<T = unknown>(key: string): T;
|
|
5
|
+
delete(key: string): void;
|
|
5
6
|
isValidated(key: string): boolean;
|
|
6
7
|
setValidated(key: string): void;
|
|
7
8
|
clone(): IPolicyData;
|
|
@@ -13,6 +14,7 @@ export declare class PolicyData implements IPolicyData {
|
|
|
13
14
|
set<T = unknown>(key: string, value: T): void;
|
|
14
15
|
get<T = unknown>(key: string): T;
|
|
15
16
|
has(key: string): boolean;
|
|
17
|
+
delete(key: string): void;
|
|
16
18
|
setValidated(key: string): void;
|
|
17
19
|
isValidated(key: string): boolean;
|
|
18
20
|
clone(): PolicyData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/policy/data.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAI,IAAI,CAAC;IACxC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/policy/data.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAI,IAAI,CAAC;IACxC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC,CAAC;IAClC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI,CAAC;IAE3B,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI,CAAC;IAEjC,KAAK,IAAK,WAAW,CAAA;CACxB;AAED,qBAAa,UAAW,YAAW,WAAW;IAC1C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEpC,SAAS,CAAC,SAAS,EAAG,GAAG,CAAC,MAAM,CAAC,CAAC;gBAG9B,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAC9B,SAAS,GAAE,GAAG,CAAC,MAAM,CAAa;IAMtC,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAI,IAAI;IAK9C,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAI,CAAC;IAQjC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI;IAK1B,YAAY,CAAC,GAAG,EAAE,MAAM,GAAI,IAAI;IAIhC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAI,OAAO;IAIlC,KAAK;CAGR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/define.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAGxF,wBAAgB,6BAA6B,CACzC,KAAK,GAAE,4BAAiC,GACxC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/define.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAGxF,wBAAgB,6BAA6B,CACzC,KAAK,GAAE,4BAAiC,GACxC,uBAAuB,CAW1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/index.ts"],"names":[],"mappings":"AAOA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PolicyTransitionSink } from './types.ts';
|
|
2
|
+
export type PolicyTransitionCollector = PolicyTransitionSink & {
|
|
3
|
+
/**
|
|
4
|
+
* The earliest reported instant, or undefined when nothing reported one.
|
|
5
|
+
*/
|
|
6
|
+
readonly next: Date | undefined;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* A sink keeping the earliest reported instant, which is the moment an answer
|
|
10
|
+
* built from every evaluation it was handed to stops being current.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createPolicyTransitionCollector(): PolicyTransitionCollector;
|
|
13
|
+
//# sourceMappingURL=transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/transition.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,GAAG;IAC3D;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,CAAA;CAClC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,+BAA+B,IAAK,yBAAyB,CAa5E"}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { PolicyData } from '../../data.ts';
|
|
2
2
|
import type { IPolicyEvaluator } from '../types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Receives the instants at which a clock-dependent verdict could change.
|
|
5
|
+
*
|
|
6
|
+
* A `date` or `time` policy that fell back to the real clock (no `date` / `time`
|
|
7
|
+
* key in the bag) reports the next strictly-future instant its own verdict could
|
|
8
|
+
* flip, from inside the evaluation walk that already runs. A caller that caches
|
|
9
|
+
* an answer derived from such a walk learns when to stop trusting it. Reports may
|
|
10
|
+
* be early (conservative) but never late, and `invert` does not move them.
|
|
11
|
+
*/
|
|
12
|
+
export type PolicyTransitionSink = {
|
|
13
|
+
report(at: Date): void;
|
|
14
|
+
};
|
|
3
15
|
export type PolicyEvaluationContext = {
|
|
4
16
|
readonly evaluators: Record<string, IPolicyEvaluator>;
|
|
5
17
|
readonly path: (string | number)[];
|
|
@@ -13,6 +25,21 @@ export type PolicyEvaluationContext = {
|
|
|
13
25
|
* query-build callers opt in.
|
|
14
26
|
*/
|
|
15
27
|
readonly withConditions: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Row column the realm reach is LOWERED onto, for a caller whose rows carry the
|
|
30
|
+
* realm under another name (a junction's `roleRealmId` / `clientRealmId` / …).
|
|
31
|
+
* Default `realmId`. It reaches `RealmMatchPolicyEvaluator` scope mode as
|
|
32
|
+
* `attributeName`, which that mode reads only while lowering — settled
|
|
33
|
+
* evaluation takes the resource realm from the `realmMatch` data key and never
|
|
34
|
+
* consults a column name, so this can never change an evaluate() outcome.
|
|
35
|
+
*/
|
|
36
|
+
readonly realmAttributeName?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional receiver of clock transitions (see {@link PolicyTransitionSink}).
|
|
39
|
+
* Nested evaluations inherit it, since every walk propagates the context by
|
|
40
|
+
* spread.
|
|
41
|
+
*/
|
|
42
|
+
readonly transitions?: PolicyTransitionSink;
|
|
16
43
|
};
|
|
17
44
|
export type PolicyEvaluationContextInput = Partial<PolicyEvaluationContext>;
|
|
18
45
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/policy/evaluation/context/types.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,MAAM,CAAC,EAAE,EAAE,IAAI,GAAG,IAAI,CAAA;CACzB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC;;;;;;;OAOG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,oBAAoB,CAAA;CAC9C,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC"}
|
package/dist/policy/types.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import type { Container } from 'validup';
|
|
2
|
+
/**
|
|
3
|
+
* A policy type's configuration validator, keyed by the type it validates.
|
|
4
|
+
*/
|
|
5
|
+
export type PolicyValidators = Record<string, Container<Record<string, any>>>;
|
|
1
6
|
export type BasePolicy<T extends string = string> = {
|
|
2
7
|
/**
|
|
3
8
|
* Type describing the policy.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/policy/types.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,CAAC,SAAS,MAAM,GAAG,MAAM,IACzB,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/policy/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IAChD;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,CACtB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACnD,CAAC,SAAS,MAAM,GAAG,MAAM,IACzB,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
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.67",
|
|
5
5
|
"description": "A library for evaluating permissions and policies.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"exports": {
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/authup/authup#readme",
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@authup/errors": "^1.0.0-beta.
|
|
58
|
-
"@authup/kit": "^1.0.0-beta.
|
|
57
|
+
"@authup/errors": "^1.0.0-beta.67",
|
|
58
|
+
"@authup/kit": "^1.0.0-beta.67",
|
|
59
59
|
"@ebec/core": "^1.3.2",
|
|
60
|
-
"@rapiq/adapter-memory": "^2.
|
|
61
|
-
"@rapiq/core": "^2.
|
|
62
|
-
"@rapiq/parser-mongo": "^2.
|
|
60
|
+
"@rapiq/adapter-memory": "^2.4.0",
|
|
61
|
+
"@rapiq/core": "^2.4.0",
|
|
62
|
+
"@rapiq/parser-mongo": "^2.4.0",
|
|
63
63
|
"@validup/zod": "^2.0.1",
|
|
64
64
|
"smob": "^1.6.1",
|
|
65
65
|
"validup": "^2.0.1",
|
|
66
|
-
"zod": "^4.5
|
|
66
|
+
"zod": "^4.6.5"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"unplugin-swc": "^1.
|
|
69
|
+
"unplugin-swc": "^1.6.0",
|
|
70
70
|
"vitest": "^4.0.14"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|