@graphoria/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/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +256 -0
- package/dist/src/AppProvider.d.ts +57 -0
- package/dist/src/AppProvider.d.ts.map +1 -0
- package/dist/src/AuthContext.d.ts +19 -0
- package/dist/src/AuthContext.d.ts.map +1 -0
- package/dist/src/gates.d.ts +15 -0
- package/dist/src/gates.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/tokenStore.d.ts +16 -0
- package/dist/src/tokenStore.d.ts.map +1 -0
- package/dist/src/transport.d.ts +19 -0
- package/dist/src/transport.d.ts.map +1 -0
- package/dist/src/types.d.ts +37 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +74 -0
- package/src/AppProvider.tsx +138 -0
- package/src/AuthContext.tsx +365 -0
- package/src/gates.tsx +33 -0
- package/src/index.ts +23 -0
- package/src/tokenStore.ts +70 -0
- package/src/transport.ts +84 -0
- package/src/types.ts +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Alex Ferreli
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Graphoria
|
|
2
|
+
Copyright 2026 Alex Ferreli
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Alex Ferreli and contributors.
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this software except in compliance with the License.
|
|
8
|
+
You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
package/README.md
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
# @graphoria/react
|
|
2
|
+
|
|
3
|
+
Client-agnostic React auth + route helpers for Graphoria servers. Owns the auth lifecycle (`auth_login` / `auth_refresh` / `auth_logout`, proactive token refresh, single-flight 401 retry) and exposes a tiny event API your GraphQL client of choice — Apollo, urql, relay, raw fetch — plugs into.
|
|
4
|
+
|
|
5
|
+
> Full guide: [docs/REACT.md](../../docs/REACT.md).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
bun add @graphoria/react
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`react` is the only peer dependency. No GraphQL client is bundled — install the one you want separately.
|
|
14
|
+
|
|
15
|
+
## Quick start
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { AppProvider, useAuth } from "@graphoria/react";
|
|
19
|
+
|
|
20
|
+
type Role = "user" | "admin";
|
|
21
|
+
|
|
22
|
+
function App() {
|
|
23
|
+
return (
|
|
24
|
+
<AppProvider<Role>
|
|
25
|
+
httpUri="http://localhost:3000/graphql"
|
|
26
|
+
routeConfig={{
|
|
27
|
+
permissions: {
|
|
28
|
+
"/admin": ["admin"],
|
|
29
|
+
"/dashboard": ["user", "admin"],
|
|
30
|
+
"/login": null,
|
|
31
|
+
},
|
|
32
|
+
defaultRoutes: { user: "/dashboard", admin: "/admin" },
|
|
33
|
+
fallbackRoute: "/dashboard",
|
|
34
|
+
}}
|
|
35
|
+
onLogout={() => apolloClient.clearStore()}
|
|
36
|
+
onTokenRefresh={() => wsClient.terminate()}
|
|
37
|
+
>
|
|
38
|
+
<YourGraphqlClientProvider>
|
|
39
|
+
<YourRoutes />
|
|
40
|
+
</YourGraphqlClientProvider>
|
|
41
|
+
</AppProvider>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function LoginButton() {
|
|
46
|
+
const { login, isAuthenticated, error } = useAuth<Role>();
|
|
47
|
+
if (isAuthenticated) return null;
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<button onClick={() => login("alice", "secret")}>Sign in</button>
|
|
51
|
+
{error && <p>{error}</p>}
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`AppProvider` mounts the auth context and the route-config context. Wrap your chosen GraphQL client's provider _inside_ it so the client can read tokens / events from this package.
|
|
58
|
+
|
|
59
|
+
## Render gates
|
|
60
|
+
|
|
61
|
+
Three router-agnostic components for conditional UI based on auth state. All read from `useAuth`, all accept an optional `fallback` (defaults to `null`).
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import { Authorize, Authenticated, Unauthenticated } from "@graphoria/react";
|
|
65
|
+
|
|
66
|
+
<Authenticated fallback={<LoginPrompt />}>
|
|
67
|
+
<Dashboard />
|
|
68
|
+
</Authenticated>
|
|
69
|
+
|
|
70
|
+
<Unauthenticated>
|
|
71
|
+
<MarketingHero />
|
|
72
|
+
</Unauthenticated>
|
|
73
|
+
|
|
74
|
+
<Authorize<Role> roles={["admin"]} fallback={<NotAllowed />}>
|
|
75
|
+
<AdminPanel />
|
|
76
|
+
</Authorize>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`<Authorize roles={[]}>` always renders `fallback` — i.e. an empty role list is "nobody is allowed".
|
|
80
|
+
|
|
81
|
+
## Public exports
|
|
82
|
+
|
|
83
|
+
| Export | Kind | Purpose |
|
|
84
|
+
| -------------------------- | --------- | ---------------------------------------------------------------------- |
|
|
85
|
+
| `AppProvider` | component | Combined Auth + Route-config provider. |
|
|
86
|
+
| `AuthProvider` | component | Just the auth context. |
|
|
87
|
+
| `useAuth<TRole>()` | hook | Auth state + `login` / `logout` / `refreshToken` / role checks. |
|
|
88
|
+
| `useRouteConfig<TRole>()` | hook | Route permission helpers. |
|
|
89
|
+
| `useCanAccess(path)` | hook | `boolean` — can the current user access `path`? |
|
|
90
|
+
| `Authorize` | component | Renders children when the user has any of the given roles. |
|
|
91
|
+
| `Authenticated` | component | Renders children when the user is signed in. |
|
|
92
|
+
| `Unauthenticated` | component | Renders children when the user is signed out. |
|
|
93
|
+
| `getAccessToken()` | function | Synchronous read of the in-memory access token. Use in your auth link. |
|
|
94
|
+
| `setAccessToken(token)` | function | Set/clear the in-memory access token (rare — usually internal). |
|
|
95
|
+
| `subscribeAccessToken(cb)` | function | Subscribe to token changes (returns unsubscribe). Use to restart WS. |
|
|
96
|
+
| `ensureFreshToken()` | function | Single-flight refresh. Call from your client's 401 handler. |
|
|
97
|
+
| `GraphQLFetchError` | class | Error thrown by built-in auth fetch (status, body, errors). |
|
|
98
|
+
|
|
99
|
+
Types: `User`, `AuthState`, `AuthContextType`, `TokenResponse`, `RouteConfig`, `RouteConfigContextType`, `AuthTransportOptions`.
|
|
100
|
+
|
|
101
|
+
## Integration recipes
|
|
102
|
+
|
|
103
|
+
### Apollo Client
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { ApolloClient, ApolloLink, HttpLink, InMemoryCache, Observable } from "@apollo/client";
|
|
107
|
+
import { CombinedGraphQLErrors, ServerError } from "@apollo/client/errors";
|
|
108
|
+
import { SetContextLink } from "@apollo/client/link/context";
|
|
109
|
+
import { ErrorLink } from "@apollo/client/link/error";
|
|
110
|
+
import { GraphQLWsLink } from "@apollo/client/link/subscriptions";
|
|
111
|
+
import { getMainDefinition } from "@apollo/client/utilities";
|
|
112
|
+
import { createClient } from "graphql-ws";
|
|
113
|
+
import { getAccessToken, ensureFreshToken, subscribeAccessToken } from "@graphoria/react";
|
|
114
|
+
|
|
115
|
+
const authLink = new SetContextLink((_, ctx) => {
|
|
116
|
+
const token = getAccessToken();
|
|
117
|
+
return {
|
|
118
|
+
headers: {
|
|
119
|
+
...(ctx as { headers?: Record<string, string> }).headers,
|
|
120
|
+
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
const errorLink = new ErrorLink(({ error, operation, forward }) => {
|
|
126
|
+
const is401 =
|
|
127
|
+
(CombinedGraphQLErrors.is(error) &&
|
|
128
|
+
error.errors.some((e) => e.extensions?.code === "UNAUTHENTICATED")) ||
|
|
129
|
+
(ServerError.is(error) && error.statusCode === 401);
|
|
130
|
+
if (!is401) return;
|
|
131
|
+
|
|
132
|
+
return new Observable((observer) => {
|
|
133
|
+
ensureFreshToken().then((ok) => {
|
|
134
|
+
if (!ok) return observer.complete();
|
|
135
|
+
forward(operation).subscribe(observer);
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const wsClient = createClient({
|
|
141
|
+
url: "ws://localhost:3000/graphql",
|
|
142
|
+
connectionParams: () => {
|
|
143
|
+
const t = getAccessToken();
|
|
144
|
+
return t ? { Authorization: `Bearer ${t}` } : {};
|
|
145
|
+
},
|
|
146
|
+
retryAttempts: Infinity,
|
|
147
|
+
});
|
|
148
|
+
// Restart WS whenever the token rotates so subscriptions pick up new auth.
|
|
149
|
+
subscribeAccessToken(() => wsClient.terminate());
|
|
150
|
+
|
|
151
|
+
const httpChain = ApolloLink.from([
|
|
152
|
+
errorLink,
|
|
153
|
+
authLink,
|
|
154
|
+
new HttpLink({
|
|
155
|
+
uri: "/graphql",
|
|
156
|
+
credentials: "include",
|
|
157
|
+
}),
|
|
158
|
+
]);
|
|
159
|
+
|
|
160
|
+
const splitLink = ApolloLink.split(
|
|
161
|
+
({ query }) => {
|
|
162
|
+
const d = getMainDefinition(query);
|
|
163
|
+
return d.kind === "OperationDefinition" && d.operation === "subscription";
|
|
164
|
+
},
|
|
165
|
+
new GraphQLWsLink(wsClient),
|
|
166
|
+
httpChain,
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
export const apolloClient = new ApolloClient({
|
|
170
|
+
link: splitLink,
|
|
171
|
+
cache: new InMemoryCache(),
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Wire `onLogout={() => apolloClient.clearStore()}` on `AppProvider`.
|
|
176
|
+
|
|
177
|
+
### urql
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
import { Client, cacheExchange, fetchExchange, subscriptionExchange } from "urql";
|
|
181
|
+
import { authExchange } from "@urql/exchange-auth";
|
|
182
|
+
import { createClient as createWsClient } from "graphql-ws";
|
|
183
|
+
import { getAccessToken, ensureFreshToken, subscribeAccessToken } from "@graphoria/react";
|
|
184
|
+
|
|
185
|
+
const wsClient = createWsClient({
|
|
186
|
+
url: "ws://localhost:3000/graphql",
|
|
187
|
+
connectionParams: () => {
|
|
188
|
+
const t = getAccessToken();
|
|
189
|
+
return t ? { Authorization: `Bearer ${t}` } : {};
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
subscribeAccessToken(() => wsClient.terminate());
|
|
193
|
+
|
|
194
|
+
export const urqlClient = new Client({
|
|
195
|
+
url: "/graphql",
|
|
196
|
+
fetchOptions: { credentials: "include" },
|
|
197
|
+
exchanges: [
|
|
198
|
+
cacheExchange,
|
|
199
|
+
authExchange(async () => ({
|
|
200
|
+
addAuthToOperation(op) {
|
|
201
|
+
const t = getAccessToken();
|
|
202
|
+
if (!t) return op;
|
|
203
|
+
const fetchOpts =
|
|
204
|
+
typeof op.context.fetchOptions === "function"
|
|
205
|
+
? op.context.fetchOptions()
|
|
206
|
+
: (op.context.fetchOptions ?? {});
|
|
207
|
+
return {
|
|
208
|
+
...op,
|
|
209
|
+
context: {
|
|
210
|
+
...op.context,
|
|
211
|
+
fetchOptions: {
|
|
212
|
+
...fetchOpts,
|
|
213
|
+
headers: {
|
|
214
|
+
...(fetchOpts.headers ?? {}),
|
|
215
|
+
Authorization: `Bearer ${t}`,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
didAuthError(err) {
|
|
222
|
+
return (
|
|
223
|
+
err.response?.status === 401 ||
|
|
224
|
+
err.graphQLErrors.some((e) => e.extensions?.code === "UNAUTHENTICATED")
|
|
225
|
+
);
|
|
226
|
+
},
|
|
227
|
+
async refreshAuth() {
|
|
228
|
+
await ensureFreshToken();
|
|
229
|
+
},
|
|
230
|
+
})),
|
|
231
|
+
fetchExchange,
|
|
232
|
+
subscriptionExchange({
|
|
233
|
+
forwardSubscription: (op) => ({
|
|
234
|
+
subscribe: (sink) => ({
|
|
235
|
+
unsubscribe: wsClient.subscribe(op, sink),
|
|
236
|
+
}),
|
|
237
|
+
}),
|
|
238
|
+
}),
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Wire `onLogout={() => urqlClient.reexecuteQuery(...)}` (or just unmount your Provider) on `AppProvider`.
|
|
244
|
+
|
|
245
|
+
## Notes
|
|
246
|
+
|
|
247
|
+
- Tokens live **in memory only** — no `localStorage` write. Recovered on reload via `auth_refresh` if the server set the `httpOnly` refresh cookie.
|
|
248
|
+
- The provider proactively refreshes ~30s before `expires_in` elapses. `ensureFreshToken` is the reactive fallback for 401s caused by clock skew or server-side revocation.
|
|
249
|
+
- `ensureFreshToken` deduplicates concurrent callers (one in-flight refresh shared across pending requests) and triggers logout on failure.
|
|
250
|
+
- `useAuth` and `useRouteConfig` must both be used inside `AppProvider` (or a manually composed `AuthProvider`).
|
|
251
|
+
|
|
252
|
+
## See also
|
|
253
|
+
|
|
254
|
+
- [React SDK guide](../../docs/REACT.md)
|
|
255
|
+
- [Authentication](../../docs/AUTHENTICATION.md)
|
|
256
|
+
- [Subscriptions](../../docs/SUBSCRIPTIONS.md)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AuthTransportOptions, RouteConfig } from "./types";
|
|
3
|
+
export interface RouteConfigContextType<TRole extends string = string> {
|
|
4
|
+
config: RouteConfig<TRole>;
|
|
5
|
+
isProtectedRoute: (path: string) => boolean;
|
|
6
|
+
getRequiredRoles: (path: string) => TRole[] | null;
|
|
7
|
+
canRoleAccess: (path: string, role: TRole | null) => boolean;
|
|
8
|
+
getRedirectPath: (role: TRole, returnTo?: string) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare function useRouteConfig<TRole extends string = string>(): RouteConfigContextType<TRole>;
|
|
11
|
+
interface AppProviderProps<TRole extends string = string> extends AuthTransportOptions {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
/** Route configuration with permissions and default routes */
|
|
14
|
+
routeConfig: RouteConfig<TRole>;
|
|
15
|
+
/** Called when authentication state changes */
|
|
16
|
+
onAuthChange?: (user: {
|
|
17
|
+
role: TRole;
|
|
18
|
+
} | null) => void;
|
|
19
|
+
/** Called after server logout completes — clear your GraphQL cache here */
|
|
20
|
+
onLogout?: () => void | Promise<void>;
|
|
21
|
+
/** Called after a successful token refresh — restart your WS / re-auth your middleware */
|
|
22
|
+
onTokenRefresh?: (accessToken: string, expiresIn: number) => void;
|
|
23
|
+
/** Rendered while initial session refresh is in flight */
|
|
24
|
+
loadingFallback?: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Main application provider. Wraps the app with:
|
|
28
|
+
* - AuthProvider (authentication state + proactive token refresh)
|
|
29
|
+
* - RouteConfigContext (route access control)
|
|
30
|
+
*
|
|
31
|
+
* Bring your own GraphQL client. Wire it via `getAccessToken`,
|
|
32
|
+
* `subscribeAccessToken`, and `ensureFreshToken` from the public API.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```tsx
|
|
36
|
+
* const routeConfig: RouteConfig = {
|
|
37
|
+
* permissions: { "/": null, "/dashboard": ["admin", "judge"] },
|
|
38
|
+
* defaultRoutes: { admin: "/dashboard", judge: "/dashboard" },
|
|
39
|
+
* fallbackRoute: "/dashboard",
|
|
40
|
+
* };
|
|
41
|
+
*
|
|
42
|
+
* <AppProvider
|
|
43
|
+
* routeConfig={routeConfig}
|
|
44
|
+
* onLogout={() => apolloClient.clearStore()}
|
|
45
|
+
* onTokenRefresh={() => wsClient.terminate()}
|
|
46
|
+
* >
|
|
47
|
+
* <App />
|
|
48
|
+
* </AppProvider>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function AppProvider<TRole extends string = string>({ children, routeConfig, onAuthChange, onLogout, onTokenRefresh, loadingFallback, httpUri, includeCredentials, }: AppProviderProps<TRole>): import("react").JSX.Element;
|
|
52
|
+
/**
|
|
53
|
+
* Hook to check if current user can access a specific route.
|
|
54
|
+
*/
|
|
55
|
+
export declare function useCanAccess(path: string): boolean;
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=AppProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppProvider.d.ts","sourceRoot":"","sources":["../../src/AppProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AASjE,MAAM,WAAW,sBAAsB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM;IACnE,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC3B,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC5C,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,EAAE,GAAG,IAAI,CAAC;IACnD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,GAAG,IAAI,KAAK,OAAO,CAAC;IAC7D,eAAe,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AAID,wBAAgB,cAAc,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,KAAK,sBAAsB,CAAC,KAAK,CAAC,CAM7F;AAED,UAAU,gBAAgB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,oBAAoB;IACpF,QAAQ,EAAE,SAAS,CAAC;IACpB,8DAA8D;IAC9D,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAChC,+CAA+C;IAC/C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,KAAK,CAAA;KAAE,GAAG,IAAI,KAAK,IAAI,CAAC;IACtD,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,0DAA0D;IAC1D,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,EACzD,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,eAAe,EACf,OAAO,EACP,kBAAkB,GACnB,EAAE,gBAAgB,CAAC,KAAK,CAAC,+BAiBzB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAQlD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AuthContextType, AuthTransportOptions, User } from "./types";
|
|
3
|
+
interface AuthProviderProps<TRole extends string> extends AuthTransportOptions {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Called when authentication state changes */
|
|
6
|
+
onAuthChange?: (user: User<TRole> | null) => void;
|
|
7
|
+
/** Called after server logout completes — user can clear GraphQL cache here */
|
|
8
|
+
onLogout?: () => void | Promise<void>;
|
|
9
|
+
/** Called after a successful token refresh — user can restart WS / re-auth middleware */
|
|
10
|
+
onTokenRefresh?: (accessToken: string, expiresIn: number) => void;
|
|
11
|
+
/** Rendered while initial session refresh is in flight (default: null) */
|
|
12
|
+
loadingFallback?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function AuthProvider<TRole extends string = string>({ children, onAuthChange, onLogout, onTokenRefresh, loadingFallback, httpUri, includeCredentials, }: AuthProviderProps<TRole>): import("react").JSX.Element;
|
|
15
|
+
export declare function useAuth<TRole extends string = string>(): AuthContextType<TRole>;
|
|
16
|
+
/** @internal Test-only: flushes the StrictMode boot-refresh cache. Not re-exported from index.ts. */
|
|
17
|
+
export declare function __resetBootRefreshCacheForTest(): void;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=AuthContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../src/AuthContext.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,eAAe,EAEf,oBAAoB,EAEpB,IAAI,EACL,MAAM,SAAS,CAAC;AA6EjB,UAAU,iBAAiB,CAAC,KAAK,SAAS,MAAM,CAAE,SAAQ,oBAAoB;IAC5E,QAAQ,EAAE,SAAS,CAAC;IACpB,+CAA+C;IAC/C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,yFAAyF;IACzF,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClE,0EAA0E;IAC1E,eAAe,CAAC,EAAE,SAAS,CAAC;CAC7B;AAED,wBAAgB,YAAY,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,EAC1D,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,eAAsB,EACtB,OAAoB,EACpB,kBAAyB,GAC1B,EAAE,iBAAiB,CAAC,KAAK,CAAC,+BA6O1B;AAED,wBAAgB,OAAO,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,KAAK,eAAe,CAAC,KAAK,CAAC,CAM/E;AAED,qGAAqG;AACrG,wBAAgB,8BAA8B,IAAI,IAAI,CAErD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface AuthorizeProps<TRole extends string> {
|
|
3
|
+
roles: TRole[];
|
|
4
|
+
fallback?: ReactNode;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function Authorize<TRole extends string = string>({ roles, fallback, children, }: AuthorizeProps<TRole>): import("react").JSX.Element;
|
|
8
|
+
interface GateProps {
|
|
9
|
+
fallback?: ReactNode;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function Authenticated({ fallback, children }: GateProps): import("react").JSX.Element;
|
|
13
|
+
export declare function Unauthenticated({ fallback, children }: GateProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=gates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gates.d.ts","sourceRoot":"","sources":["../../src/gates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,UAAU,cAAc,CAAC,KAAK,SAAS,MAAM;IAC3C,KAAK,EAAE,KAAK,EAAE,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,EAAE,EACvD,KAAK,EACL,QAAe,EACf,QAAQ,GACT,EAAE,cAAc,CAAC,KAAK,CAAC,+BAGvB;AAED,UAAU,SAAS;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAe,EAAE,QAAQ,EAAE,EAAE,SAAS,+BAGrE;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAe,EAAE,QAAQ,EAAE,EAAE,SAAS,+BAGvE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { AuthProvider, useAuth } from "./AuthContext";
|
|
2
|
+
export { AppProvider, useRouteConfig, useCanAccess, type RouteConfigContextType, } from "./AppProvider";
|
|
3
|
+
export { Authorize, Authenticated, Unauthenticated } from "./gates";
|
|
4
|
+
export { getAccessToken, setAccessToken, subscribeAccessToken, ensureFreshToken, } from "./tokenStore";
|
|
5
|
+
export { GraphQLFetchError } from "./transport";
|
|
6
|
+
export type { User, AuthState, AuthContextType, TokenResponse, RouteConfig, AuthTransportOptions, } from "./types";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EACL,WAAW,EACX,cAAc,EACd,YAAY,EACZ,KAAK,sBAAsB,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EACL,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EACV,IAAI,EACJ,SAAS,EACT,eAAe,EACf,aAAa,EACb,WAAW,EACX,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
type RefreshHandler = () => Promise<boolean>;
|
|
2
|
+
type LogoutHandler = () => Promise<void> | void;
|
|
3
|
+
type Listener = (token: string | null) => void;
|
|
4
|
+
export declare function getAccessToken(): string | null;
|
|
5
|
+
export declare function setAccessToken(token: string | null): void;
|
|
6
|
+
/** Subscribe to token changes. Returns unsubscribe fn. */
|
|
7
|
+
export declare function subscribeAccessToken(cb: Listener): () => void;
|
|
8
|
+
export declare function setRefreshHandler(fn: RefreshHandler | null): void;
|
|
9
|
+
export declare function setLogoutHandler(fn: LogoutHandler | null): void;
|
|
10
|
+
/**
|
|
11
|
+
* Single-flight token refresh. Call from any GraphQL client's 401 handler.
|
|
12
|
+
* Concurrent calls share one in-flight refresh. On failure, triggers logout.
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureFreshToken(): Promise<boolean>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=tokenStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenStore.d.ts","sourceRoot":"","sources":["../../src/tokenStore.ts"],"names":[],"mappings":"AAWA,KAAK,cAAc,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAC7C,KAAK,aAAa,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAChD,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;AAQ/C,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAIzD;AAED,0DAA0D;AAC1D,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,IAAI,CAG7D;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,GAAG,IAAI,CAEjE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAE/D;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAoBnD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface GraphQLError {
|
|
2
|
+
message: string;
|
|
3
|
+
extensions?: Record<string, unknown>;
|
|
4
|
+
path?: ReadonlyArray<string | number>;
|
|
5
|
+
}
|
|
6
|
+
export declare class GraphQLFetchError extends Error {
|
|
7
|
+
status: number;
|
|
8
|
+
body: string;
|
|
9
|
+
errors?: GraphQLError[];
|
|
10
|
+
constructor(message: string, status: number, body: string, errors?: GraphQLError[]);
|
|
11
|
+
}
|
|
12
|
+
interface GqlFetchOptions {
|
|
13
|
+
bearer?: string | null;
|
|
14
|
+
credentials?: boolean;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
}
|
|
17
|
+
export declare function gqlFetch<T>(uri: string, query: string, variables: Record<string, unknown> | undefined, opts?: GqlFetchOptions): Promise<T>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CACvC;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE;CAOnF;AAED,UAAU,eAAe;IACvB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC9C,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,CAAC,CAAC,CA0CZ"}
|