@atlasauth/react 0.1.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.
- package/dist/AtlasProvider.d.ts +59 -0
- package/dist/AtlasProvider.js +248 -0
- package/dist/AtlasProvider.js.map +1 -0
- package/dist/appearance.d.ts +85 -0
- package/dist/appearance.js +98 -0
- package/dist/appearance.js.map +1 -0
- package/dist/components.d.ts +40 -0
- package/dist/components.js +241 -0
- package/dist/components.js.map +1 -0
- package/dist/fapi.d.ts +11 -0
- package/dist/fapi.js +24 -0
- package/dist/fapi.js.map +1 -0
- package/dist/hooks.d.ts +62 -0
- package/dist/hooks.js +96 -0
- package/dist/hooks.js.map +1 -0
- package/dist/i18n.d.ts +23 -0
- package/dist/i18n.js +83 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/protect.d.ts +18 -0
- package/dist/protect.js +24 -0
- package/dist/protect.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* §10.2 `<Protect permission="org:sys_memberships:manage">` — conditional
|
|
3
|
+
* rendering.
|
|
4
|
+
*
|
|
5
|
+
* The rule that makes this safe to ship: this is a RENDERING helper, never an
|
|
6
|
+
* authorization boundary. It decides what a user sees, and seeing is not doing.
|
|
7
|
+
* Anyone can open devtools and flip the condition; the only thing that stops
|
|
8
|
+
* them acting is the server checking the same permission on the request.
|
|
9
|
+
*
|
|
10
|
+
* That is worth stating loudly because the component reads like a guard, and a
|
|
11
|
+
* developer who believes it is one will eventually put a delete button behind
|
|
12
|
+
* it and no check behind the endpoint.
|
|
13
|
+
*
|
|
14
|
+
* The evaluation logic lives in `@atlasauth/authz` — the ONE primitive every SDK
|
|
15
|
+
* (backend, Next.js, React, React Native, JS) shares, so `<Protect>` here and
|
|
16
|
+
* `auth().has()` on the server judge a condition identically.
|
|
17
|
+
*/
|
|
18
|
+
export { type ProtectCondition, type ProtectOutcome, type ProtectReason, evaluate, hasFromClaims, } from '@atlasauth/authz';
|
package/dist/protect.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasFromClaims = exports.evaluate = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* §10.2 `<Protect permission="org:sys_memberships:manage">` — conditional
|
|
6
|
+
* rendering.
|
|
7
|
+
*
|
|
8
|
+
* The rule that makes this safe to ship: this is a RENDERING helper, never an
|
|
9
|
+
* authorization boundary. It decides what a user sees, and seeing is not doing.
|
|
10
|
+
* Anyone can open devtools and flip the condition; the only thing that stops
|
|
11
|
+
* them acting is the server checking the same permission on the request.
|
|
12
|
+
*
|
|
13
|
+
* That is worth stating loudly because the component reads like a guard, and a
|
|
14
|
+
* developer who believes it is one will eventually put a delete button behind
|
|
15
|
+
* it and no check behind the endpoint.
|
|
16
|
+
*
|
|
17
|
+
* The evaluation logic lives in `@atlasauth/authz` — the ONE primitive every SDK
|
|
18
|
+
* (backend, Next.js, React, React Native, JS) shares, so `<Protect>` here and
|
|
19
|
+
* `auth().has()` on the server judge a condition identically.
|
|
20
|
+
*/
|
|
21
|
+
var authz_1 = require("@atlasauth/authz");
|
|
22
|
+
Object.defineProperty(exports, "evaluate", { enumerable: true, get: function () { return authz_1.evaluate; } });
|
|
23
|
+
Object.defineProperty(exports, "hasFromClaims", { enumerable: true, get: function () { return authz_1.hasFromClaims; } });
|
|
24
|
+
//# sourceMappingURL=protect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protect.js","sourceRoot":"","sources":["../src/protect.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,0CAM0B;AAFxB,iGAAA,QAAQ,OAAA;AACR,sGAAA,aAAa,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface SessionClaims {
|
|
2
|
+
sub: string;
|
|
3
|
+
sid: string;
|
|
4
|
+
exp: number;
|
|
5
|
+
org_id?: string;
|
|
6
|
+
org_slug?: string;
|
|
7
|
+
org_role?: string;
|
|
8
|
+
org_permissions?: string[];
|
|
9
|
+
mfa?: boolean;
|
|
10
|
+
[claim: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface AtlasUser {
|
|
13
|
+
id: string;
|
|
14
|
+
first_name: string | null;
|
|
15
|
+
last_name: string | null;
|
|
16
|
+
username: string | null;
|
|
17
|
+
image_url: string | null;
|
|
18
|
+
public_metadata: Record<string, unknown>;
|
|
19
|
+
unsafe_metadata: Record<string, unknown>;
|
|
20
|
+
mfa_enabled: boolean;
|
|
21
|
+
has_password: boolean;
|
|
22
|
+
email_addresses?: Array<{
|
|
23
|
+
id: string;
|
|
24
|
+
email_address: string;
|
|
25
|
+
verified: boolean;
|
|
26
|
+
primary: boolean;
|
|
27
|
+
}>;
|
|
28
|
+
}
|
|
29
|
+
export interface AtlasOrganizationMembership {
|
|
30
|
+
role: string;
|
|
31
|
+
organization: {
|
|
32
|
+
id: string;
|
|
33
|
+
name: string;
|
|
34
|
+
slug: string;
|
|
35
|
+
image_url: string | null;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface AtlasSession {
|
|
39
|
+
id: string;
|
|
40
|
+
status: string;
|
|
41
|
+
last_active_organization_id: string | null;
|
|
42
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlasauth/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@atlasauth/js": "0.1.0",
|
|
8
|
+
"@atlasauth/authz": "0.1.0"
|
|
9
|
+
},
|
|
10
|
+
"peerDependencies": {
|
|
11
|
+
"react": ">=18"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/react": "^18.3.12",
|
|
15
|
+
"react": "^18.3.1",
|
|
16
|
+
"typescript": "^5.6.3",
|
|
17
|
+
"vitest": "^2.1.4"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md"
|
|
25
|
+
],
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc -p tsconfig.build.json",
|
|
28
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
29
|
+
"test": "vitest run"
|
|
30
|
+
}
|
|
31
|
+
}
|