@cedarjs/router 8.0.0-canary.3562 → 8.0.0-canary.3567
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/AuthenticatedRoute.d.ts +0 -1
- package/dist/AuthenticatedRoute.d.ts.map +1 -1
- package/dist/AuthenticatedRoute.js +5 -8
- package/dist/Set.d.ts +8 -16
- package/dist/Set.d.ts.map +1 -1
- package/dist/analyzeRoutes.d.ts +0 -1
- package/dist/analyzeRoutes.d.ts.map +1 -1
- package/dist/analyzeRoutes.js +0 -3
- package/dist/router-context.d.ts +5 -5
- package/dist/router-context.d.ts.map +1 -1
- package/dist/router.d.ts +2 -2
- package/dist/router.js +0 -1
- package/dist/rsc/ClientRouter.js +0 -3
- package/dist/rsc/ServerRouter.js +0 -5
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthenticatedRoute.d.ts","sourceRoot":"","sources":["../src/AuthenticatedRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAQxD,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,
|
|
1
|
+
{"version":3,"file":"AuthenticatedRoute.d.ts","sourceRoot":"","sources":["../src/AuthenticatedRoute.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAQxD,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACnD;AA6ED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CA6IhE,CAAA"}
|
|
@@ -6,7 +6,6 @@ import { paramsForRoute, pathParamsText } from "./util.js";
|
|
|
6
6
|
const REPLACE = { replace: true };
|
|
7
7
|
const useNoOrg = () => null;
|
|
8
8
|
const MountedOrgContext = createContext(void 0);
|
|
9
|
-
const toList = (roles) => Array.isArray(roles) ? roles : [roles];
|
|
10
9
|
function currentPathParams(routerState, pathname) {
|
|
11
10
|
const route = Object.values(routerState.routes.pathRouteMap).find(
|
|
12
11
|
(candidate) => candidate.name === routerState.activeRouteName
|
|
@@ -47,7 +46,6 @@ const AuthenticatedRoute = ({
|
|
|
47
46
|
unauthorized,
|
|
48
47
|
roles,
|
|
49
48
|
userRoles,
|
|
50
|
-
orgRoles,
|
|
51
49
|
orgPermission,
|
|
52
50
|
whileLoadingAuth,
|
|
53
51
|
children
|
|
@@ -64,12 +62,11 @@ const AuthenticatedRoute = ({
|
|
|
64
62
|
const { tenancy } = routerState;
|
|
65
63
|
const useOrg = tenancy?.useOrg ?? useNoOrg;
|
|
66
64
|
const org = useOrg(routerState.useAuth, pathParams);
|
|
67
|
-
const needsOrg =
|
|
65
|
+
const needsOrg = orgPermission !== void 0;
|
|
68
66
|
if (needsOrg && !org) {
|
|
69
|
-
const prop = orgRoles !== void 0 ? "orgRoles" : "orgPermission";
|
|
70
67
|
if (!tenancy) {
|
|
71
68
|
throw new Error(
|
|
72
|
-
|
|
69
|
+
"A PrivateSet with `orgPermission` needs `tenancy` on the Router to find the organization with. Please pass `tenancy` from `@cedarjs/tenancy/web`: <Router useAuth={useAuth} tenancy={tenancy}>"
|
|
73
70
|
);
|
|
74
71
|
}
|
|
75
72
|
if (authLoading) {
|
|
@@ -77,11 +74,11 @@ const AuthenticatedRoute = ({
|
|
|
77
74
|
}
|
|
78
75
|
if (pathParams["orgSlug"] === void 0) {
|
|
79
76
|
throw new Error(
|
|
80
|
-
|
|
77
|
+
"A PrivateSet with `orgPermission` needs an organization to check it in, and the route has no `orgSlug` param. Please only use `orgPermission` on routes with `{orgSlug}` in their path, or pass `createTenancy` a `useOrg` that finds the organization another way"
|
|
81
78
|
);
|
|
82
79
|
}
|
|
83
80
|
throw new Error(
|
|
84
|
-
|
|
81
|
+
"A PrivateSet with `orgPermission` got no organization from the Router's `tenancy` for this route, so there is nothing to check it in"
|
|
85
82
|
);
|
|
86
83
|
}
|
|
87
84
|
const hasRequiredUserRoles = (!roles || hasRole(roles)) && (!userRoles || hasRole(userRoles));
|
|
@@ -96,7 +93,7 @@ const AuthenticatedRoute = ({
|
|
|
96
93
|
}
|
|
97
94
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, tenancy.notAMember ?? null);
|
|
98
95
|
}
|
|
99
|
-
const hasRequiredOrgAccess =
|
|
96
|
+
const hasRequiredOrgAccess = orgPermission === void 0 || (membership.permissions?.includes(orgPermission) ?? false);
|
|
100
97
|
if (hasRequiredOrgAccess) {
|
|
101
98
|
if (mountedOrgId === membership.organizationId) {
|
|
102
99
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
package/dist/Set.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export interface WrapperProps {
|
|
|
26
26
|
*/
|
|
27
27
|
export type WrapperType = ComponentType<WrapperProps>;
|
|
28
28
|
/**
|
|
29
|
-
* The role props. An app with tenancy (see `AuthTenancy`) has `userRoles`
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* The role props. An app with tenancy (see `AuthTenancy`) has `userRoles`
|
|
30
|
+
* instead of `roles`, and `orgPermission` for what the user may do in the
|
|
31
|
+
* organization: there, every check says which kind it is.
|
|
32
32
|
*/
|
|
33
33
|
type SetRoles = AuthTenancy extends {
|
|
34
34
|
enabled: true;
|
|
@@ -36,30 +36,22 @@ type SetRoles = AuthTenancy extends {
|
|
|
36
36
|
/**
|
|
37
37
|
* Route is permitted when authenticated and user has any of the
|
|
38
38
|
* provided roles such as "admin" or ["admin", "editor"], in
|
|
39
|
-
* `currentUser.roles
|
|
40
|
-
* in (see `orgRoles`). With `orgRoles` as well, they need both.
|
|
39
|
+
* `currentUser.roles`. With `orgPermission` as well, they need both.
|
|
41
40
|
*/
|
|
42
41
|
userRoles?: string | string[];
|
|
43
42
|
/**
|
|
44
|
-
* Route is permitted when authenticated and user
|
|
45
|
-
*
|
|
46
|
-
*
|
|
43
|
+
* Route is permitted when authenticated and the user's membership in
|
|
44
|
+
* the current organization has this permission (see
|
|
45
|
+
* `createPermissions` in `@cedarjs/tenancy`).
|
|
47
46
|
*
|
|
48
47
|
* The organization is the one the Router's `tenancy` finds for the
|
|
49
48
|
* route, by default the one with the route's `orgSlug` param:
|
|
50
49
|
*
|
|
51
50
|
* <Router useAuth={useAuth} tenancy={tenancy}>
|
|
52
51
|
*
|
|
53
|
-
* A `PrivateSet` with `
|
|
52
|
+
* A `PrivateSet` with `orgPermission` throws without `tenancy` on the
|
|
54
53
|
* router, or on a route that isn't in an organization.
|
|
55
54
|
*/
|
|
56
|
-
orgRoles?: string | string[];
|
|
57
|
-
/**
|
|
58
|
-
* Route is permitted when authenticated and the user's membership in
|
|
59
|
-
* the current organization has this permission (see
|
|
60
|
-
* `createPermissions` in `@cedarjs/tenancy`). The organization is found
|
|
61
|
-
* like for `orgRoles`, which it can be combined with: they need both.
|
|
62
|
-
*/
|
|
63
55
|
orgPermission?: PermissionName;
|
|
64
56
|
} : {
|
|
65
57
|
/**
|
package/dist/Set.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Set.d.ts","sourceRoot":"","sources":["../src/Set.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,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
package/dist/analyzeRoutes.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeRoutes.d.ts","sourceRoot":"","sources":["../src/analyzeRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAQzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,WAAW,CAAA;AAElB,KAAK,gBAAgB,GAAG,MAAM,YAAY,GAAG,IAAI,CAAA;AAIjD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,CACb,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KACtD,MAAM,CAAA;CACZ,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,SAAS,WAAW,EAAE,CAAA;AAE7C;;;GAGG;AACH,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAEzB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC7B,
|
|
1
|
+
{"version":3,"file":"analyzeRoutes.d.ts","sourceRoot":"","sources":["../src/analyzeRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAQzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC3C,OAAO,EAIL,KAAK,SA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EAAE,SAAS,CAAC,CAAA;CAC3C;AAED,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,EACnB,EAAE,eAAe,EAAE,cAAc,EAAE,EAAE,oBAAoB;;;;;;EAqK1D"}
|
package/dist/analyzeRoutes.js
CHANGED
|
@@ -28,9 +28,6 @@ function pickSetRenderProps(props) {
|
|
|
28
28
|
if (props.userRoles !== void 0) {
|
|
29
29
|
picked.userRoles = props.userRoles;
|
|
30
30
|
}
|
|
31
|
-
if (props.orgRoles !== void 0) {
|
|
32
|
-
picked.orgRoles = props.orgRoles;
|
|
33
|
-
}
|
|
34
31
|
if (props.orgPermission !== void 0) {
|
|
35
32
|
picked.orgPermission = props.orgPermission;
|
|
36
33
|
}
|
package/dist/router-context.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export type UseAuth = () => AuthContextInterface<unknown, unknown, unknown, unkn
|
|
|
13
13
|
export interface RouterMembership {
|
|
14
14
|
/** Identifies the organization, so one provider stays mounted across it */
|
|
15
15
|
organizationId: string;
|
|
16
|
-
/** The user's role in the organization,
|
|
16
|
+
/** The user's role in the organization, passed on to the `OrgProvider` */
|
|
17
17
|
role: string;
|
|
18
18
|
/** What the membership may do, for `<PrivateSet orgPermission>` */
|
|
19
19
|
permissions?: readonly string[] | undefined;
|
|
@@ -35,10 +35,10 @@ export interface RouterOrg {
|
|
|
35
35
|
*
|
|
36
36
|
* One of the app's own can answer in three ways:
|
|
37
37
|
* - an organization, with the user's membership in it or `null` for none.
|
|
38
|
-
* A set with `
|
|
38
|
+
* A set with `orgPermission` denies a user with no
|
|
39
39
|
* membership, and the router renders the tenancy's `notAMember`.
|
|
40
|
-
* - `null`, for no organization: a set with `
|
|
41
|
-
*
|
|
40
|
+
* - `null`, for no organization: a set with `orgPermission` then
|
|
41
|
+
* throws the router's own error.
|
|
42
42
|
* - throw an error of its own, such as for an organization that's been
|
|
43
43
|
* suspended. It reaches the app's error boundary like any error thrown
|
|
44
44
|
* while rendering.
|
|
@@ -55,7 +55,7 @@ export interface OrgProviderProps {
|
|
|
55
55
|
* How the router handles organizations. `createTenancy` from
|
|
56
56
|
* `@cedarjs/tenancy/web` makes one. The router renders its `OrgProvider`
|
|
57
57
|
* around the layouts and page of a `PrivateSet` whose route is in an
|
|
58
|
-
* organization, and checks `
|
|
58
|
+
* organization, and checks `orgPermission` against the
|
|
59
59
|
* membership its `useOrg` finds.
|
|
60
60
|
*/
|
|
61
61
|
export interface Tenancy {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router-context.d.ts","sourceRoot":"","sources":["../src/router-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;IACxD,iBAAiB,EAAE,QAAQ;CAC5B,CAAA;AAGD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAC9C,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,CACR,CAAA;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,cAAc,EAAE,MAAM,CAAA;IACtB,
|
|
1
|
+
{"version":3,"file":"router-context.d.ts","sourceRoot":"","sources":["../src/router-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAA;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;IACxD,iBAAiB,EAAE,QAAQ;CAC5B,CAAA;AAGD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,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OAAO,CAAA;IAChB,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;CAC5C;AAID,MAAM,WAAW,0BAA2B,SAAQ,IAAI,CACtD,WAAW,EACX,SAAS,CACV;IACC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAA;IACxC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAwBtE,CAAA;AAED,eAAO,MAAM,cAAc,mBAU1B,CAAA"}
|
package/dist/router.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ import type { RouterContextProviderProps, Tenancy } from './router-context.js';
|
|
|
7
7
|
import type { TrailingSlashesTypes } from './util.js';
|
|
8
8
|
/**
|
|
9
9
|
* `tenancy`, only in an app with tenancy (see `AuthTenancy`), where sets have
|
|
10
|
-
* `
|
|
10
|
+
* `orgPermission`
|
|
11
11
|
*/
|
|
12
12
|
type RouterTenancy = AuthTenancy extends {
|
|
13
13
|
enabled: true;
|
|
14
14
|
} ? {
|
|
15
15
|
/**
|
|
16
16
|
* How the router handles organizations: finding the one of the current
|
|
17
|
-
* route, checking `
|
|
17
|
+
* route, checking `orgPermission` in it, and providing
|
|
18
18
|
* it to the layouts and page of a `PrivateSet`. Pass the `tenancy` from
|
|
19
19
|
* `createTenancy` in `@cedarjs/tenancy/web`:
|
|
20
20
|
*
|
package/dist/router.js
CHANGED
|
@@ -164,7 +164,6 @@ const WrappedPage = memo(({ sets, children }) => {
|
|
|
164
164
|
unauthorized: set.props.unauthorized,
|
|
165
165
|
roles: set.props.roles,
|
|
166
166
|
userRoles: set.props.userRoles,
|
|
167
|
-
orgRoles: set.props.orgRoles,
|
|
168
167
|
orgPermission: set.props.orgPermission,
|
|
169
168
|
whileLoadingAuth: set.props.whileLoadingAuth
|
|
170
169
|
},
|
package/dist/rsc/ClientRouter.js
CHANGED
|
@@ -34,9 +34,6 @@ const LocationAwareRouter = ({
|
|
|
34
34
|
}
|
|
35
35
|
const requestedRoute = pathRouteMap[activeRoutePath];
|
|
36
36
|
for (const set of requestedRoute.sets) {
|
|
37
|
-
if (set.props.orgRoles !== void 0) {
|
|
38
|
-
throw new Error("`orgRoles` is not supported with RSC yet");
|
|
39
|
-
}
|
|
40
37
|
if (set.props.orgPermission !== void 0) {
|
|
41
38
|
throw new Error("`orgPermission` is not supported with RSC yet");
|
|
42
39
|
}
|
package/dist/rsc/ServerRouter.js
CHANGED
|
@@ -105,13 +105,9 @@ const AuthenticatedRoute = ({
|
|
|
105
105
|
children,
|
|
106
106
|
roles,
|
|
107
107
|
userRoles,
|
|
108
|
-
orgRoles,
|
|
109
108
|
orgPermission
|
|
110
109
|
}) => {
|
|
111
110
|
const { isAuthenticated } = getAuthState();
|
|
112
|
-
if (orgRoles !== void 0) {
|
|
113
|
-
throw new Error("`orgRoles` is not supported with RSC yet");
|
|
114
|
-
}
|
|
115
111
|
if (orgPermission !== void 0) {
|
|
116
112
|
throw new Error("`orgPermission` is not supported with RSC yet");
|
|
117
113
|
}
|
|
@@ -143,7 +139,6 @@ const WrappedPage = ({ routeLoaderElement, sets }) => {
|
|
|
143
139
|
unauthenticated,
|
|
144
140
|
roles: set.props.roles,
|
|
145
141
|
userRoles: set.props.userRoles,
|
|
146
|
-
orgRoles: set.props.orgRoles,
|
|
147
142
|
orgPermission: set.props.orgPermission,
|
|
148
143
|
whileLoadingAuth: set.props.whileLoadingAuth
|
|
149
144
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/router",
|
|
3
|
-
"version": "8.0.0-canary.
|
|
3
|
+
"version": "8.0.0-canary.3567",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -52,15 +52,15 @@
|
|
|
52
52
|
"test:watch": "vitest watch"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@cedarjs/project-config": "8.0.0-canary.
|
|
56
|
-
"@cedarjs/server-store": "8.0.0-canary.
|
|
55
|
+
"@cedarjs/project-config": "8.0.0-canary.3567",
|
|
56
|
+
"@cedarjs/server-store": "8.0.0-canary.3567",
|
|
57
57
|
"react-server-dom-webpack": "19.3.1",
|
|
58
58
|
"ts-toolbelt": "9.6.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@arethetypeswrong/cli": "0.18.5",
|
|
62
|
-
"@cedarjs/auth": "8.0.0-canary.
|
|
63
|
-
"@cedarjs/framework-tools": "8.0.0-canary.
|
|
62
|
+
"@cedarjs/auth": "8.0.0-canary.3567",
|
|
63
|
+
"@cedarjs/framework-tools": "8.0.0-canary.3567",
|
|
64
64
|
"@testing-library/jest-dom": "6.9.1",
|
|
65
65
|
"@types/react": "^19.2.0",
|
|
66
66
|
"@types/react-dom": "^19.2.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"vitest": "4.1.12"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"@cedarjs/auth": "8.0.0-canary.
|
|
77
|
+
"@cedarjs/auth": "8.0.0-canary.3567",
|
|
78
78
|
"react": "19.3.1",
|
|
79
79
|
"react-dom": "19.3.1"
|
|
80
80
|
},
|