@authup/access 1.0.0-beta.69 → 1.0.0-beta.70
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/README.md +230 -0
- package/dist/index.d.mts +75 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +100 -1
- package/dist/index.mjs.map +1 -1
- package/dist/permission/index.d.ts +1 -0
- package/dist/permission/index.d.ts.map +1 -1
- package/dist/permission/record/index.d.ts +3 -0
- package/dist/permission/record/index.d.ts.map +1 -0
- package/dist/permission/record/module.d.ts +36 -0
- package/dist/permission/record/module.d.ts.map +1 -0
- package/dist/permission/record/types.d.ts +41 -0
- package/dist/permission/record/types.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -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,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,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,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/permission/record/index.ts"],"names":[],"mappings":"AAOA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IPermissionEvaluator } from '../evaluator';
|
|
2
|
+
import type { RecordEvaluationContext, RecordUpdateEvaluationContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Throws a permission error unless `name` passes for the record: each grant's
|
|
5
|
+
* `realm_scope` is matched against the record's realm and its policies are
|
|
6
|
+
* evaluated against the record. An array of names must ALL pass, like
|
|
7
|
+
* `evaluate()`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function evaluateRecord(evaluator: IPermissionEvaluator, ctx: RecordEvaluationContext): Promise<void>;
|
|
10
|
+
/** {@link evaluateRecord} where ANY of the names suffices, like `evaluateOneOf()`. */
|
|
11
|
+
export declare function evaluateRecordOneOf(evaluator: IPermissionEvaluator, ctx: RecordEvaluationContext): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* {@link evaluateRecord} as a predicate. Only a permission error reads as
|
|
14
|
+
* `false`; anything else propagates, so a failure on the authorization path
|
|
15
|
+
* never turns into a quiet "not authorized".
|
|
16
|
+
*/
|
|
17
|
+
export declare function reachesRecord(evaluator: IPermissionEvaluator, ctx: RecordEvaluationContext): Promise<boolean>;
|
|
18
|
+
/** {@link evaluateRecordOneOf} as a predicate, like {@link reachesRecord}. */
|
|
19
|
+
export declare function reachesRecordOneOf(evaluator: IPermissionEvaluator, ctx: RecordEvaluationContext): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* An update passes only when `name` passes for BOTH the stored row (the actor
|
|
22
|
+
* may only change a row it can already reach) and the updated row (the row
|
|
23
|
+
* must stay in reach afterwards). Evaluating the updated row alone lets an
|
|
24
|
+
* update move a row INTO reach.
|
|
25
|
+
*/
|
|
26
|
+
export declare function evaluateRecordUpdate(evaluator: IPermissionEvaluator, ctx: RecordUpdateEvaluationContext): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a grant of `name` (any of, for an array) reaches every realm with
|
|
29
|
+
* no narrowing policy, i.e. `realm_scope: any`. Reads the `compile()`
|
|
30
|
+
* verdict, so it relies on the binding policy (`system.default`) being bound
|
|
31
|
+
* to the permission: without it a grant's reach is never evaluated and any
|
|
32
|
+
* grant compiles to `allow`. Fail-closed: a policy-bearing `any` grant
|
|
33
|
+
* compiles to `conditional` and reads as `false`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function hasUnboundedReach(evaluator: IPermissionEvaluator, name: string | string[]): Promise<boolean>;
|
|
36
|
+
//# sourceMappingURL=module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../src/permission/record/module.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,oBAAoB,EAA+B,MAAM,cAAc,CAAC;AACtF,OAAO,KAAK,EACR,uBAAuB,EAEvB,6BAA6B,EAChC,MAAM,SAAS,CAAC;AAuDjB;;;;;GAKG;AACH,wBAAsB,cAAc,CAChC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,uBAAuB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,sFAAsF;AACtF,wBAAsB,mBAAmB,CACrC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,uBAAuB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAEf;AAeD;;;;GAIG;AACH,wBAAsB,aAAa,CAC/B,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,uBAAuB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,8EAA8E;AAC9E,wBAAsB,kBAAkB,CACpC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,uBAAuB,GAC7B,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACtC,SAAS,EAAE,oBAAoB,EAC/B,GAAG,EAAE,6BAA6B,GACnC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACnC,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GACxB,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PolicyData, PolicyInput } from '../../policy';
|
|
2
|
+
import type { PermissionEvaluationOptions } from '../evaluator';
|
|
3
|
+
/**
|
|
4
|
+
* The realm of the record a check is evaluated against: a realm id, `null`
|
|
5
|
+
* for a global row, or a list of either when every listed realm must be
|
|
6
|
+
* reached.
|
|
7
|
+
*/
|
|
8
|
+
export type RecordRealm = string | null | (string | null)[];
|
|
9
|
+
/** One record a single-record check is evaluated against. */
|
|
10
|
+
export type RecordTarget = {
|
|
11
|
+
/**
|
|
12
|
+
* The RECORD's realm (`null` = global row), or the target realm on
|
|
13
|
+
* create. This is what each grant's `realm_scope` is matched against.
|
|
14
|
+
* It is distinct from `PermissionEvaluationContext.realmId`, which is the
|
|
15
|
+
* realm the PERMISSION is bound to. Required: `undefined` throws, so a
|
|
16
|
+
* caller cannot drop the realm by omission and neutral-pass every grant's
|
|
17
|
+
* `realm_scope`.
|
|
18
|
+
*/
|
|
19
|
+
realm: RecordRealm;
|
|
20
|
+
/**
|
|
21
|
+
* The policy data the record is evaluated with: the row under
|
|
22
|
+
* `attributes` (for attribute policies on the grant; never synthesized,
|
|
23
|
+
* so without it an attribute policy stays pending), an identity, a custom
|
|
24
|
+
* key. Never mutated; must not carry `realmMatch`, which is set from
|
|
25
|
+
* `realm`.
|
|
26
|
+
*/
|
|
27
|
+
data?: PolicyData | PolicyInput;
|
|
28
|
+
};
|
|
29
|
+
export type RecordEvaluationContext = RecordTarget & {
|
|
30
|
+
name: string | string[];
|
|
31
|
+
options?: PermissionEvaluationOptions;
|
|
32
|
+
};
|
|
33
|
+
export type RecordUpdateEvaluationContext = {
|
|
34
|
+
name: string | string[];
|
|
35
|
+
options?: PermissionEvaluationOptions;
|
|
36
|
+
/** The stored row: the actor must reach it to change it at all. */
|
|
37
|
+
current: RecordTarget;
|
|
38
|
+
/** The updated row: it must stay in reach afterwards. */
|
|
39
|
+
next: RecordTarget;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/permission/record/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAEhE;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;AAE5D,6DAA6D;AAC7D,MAAM,MAAM,YAAY,GAAG;IACvB;;;;;;;OAOG;IACH,KAAK,EAAE,WAAW,CAAC;IACnB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,YAAY,GAAG;IACjD,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,2BAA2B,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,OAAO,CAAC,EAAE,2BAA2B,CAAC;IACtC,mEAAmE;IACnE,OAAO,EAAE,YAAY,CAAC;IACtB,yDAAyD;IACzD,IAAI,EAAE,YAAY,CAAC;CACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@authup/access",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-beta.
|
|
5
|
-
"description": "
|
|
4
|
+
"version": "1.0.0-beta.70",
|
|
5
|
+
"description": "Evaluate Authup permissions and policies in your own process, with the same engine the server uses.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"exports": {
|
|
8
8
|
"./package.json": "./package.json",
|
|
@@ -54,8 +54,8 @@
|
|
|
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.70",
|
|
58
|
+
"@authup/kit": "^1.0.0-beta.70",
|
|
59
59
|
"@ebec/core": "^1.3.2",
|
|
60
60
|
"@rapiq/adapter-memory": "^2.4.0",
|
|
61
61
|
"@rapiq/core": "^2.4.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@validup/zod": "^2.0.1",
|
|
64
64
|
"smob": "^1.6.1",
|
|
65
65
|
"validup": "^2.0.1",
|
|
66
|
-
"zod": "^4.6.
|
|
66
|
+
"zod": "^4.6.7"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"unplugin-swc": "^2.0.0",
|