@graphcore/react-kernel 0.0.0 → 0.2.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 +202 -0
- package/NOTICE +2 -0
- package/dist/api/agentApi.d.ts +7 -0
- package/dist/api/entityApi.d.ts +37 -0
- package/dist/api/predicate.d.ts +37 -0
- package/dist/auth/oidc.d.ts +39 -0
- package/dist/components/Access/AccessPanel.d.ts +7 -0
- package/dist/components/Access/GroupView.d.ts +1 -0
- package/dist/components/Access/index.d.ts +5 -0
- package/dist/components/Access/useAccess.d.ts +42 -0
- package/dist/components/Admin/AdminPanel.d.ts +22 -0
- package/dist/components/Admin/index.d.ts +3 -0
- package/dist/components/Admin/useIsDeploymentAdmin.d.ts +2 -0
- package/dist/components/AgentMirror/AgentMirror.d.ts +15 -0
- package/dist/components/AgentMirror/index.d.ts +1 -0
- package/dist/components/Auth/AuthPage.d.ts +14 -0
- package/dist/components/Auth/index.d.ts +1 -0
- package/dist/components/Entity/BaseEntity.d.ts +6 -0
- package/dist/components/Entity/EntityRoute.d.ts +14 -0
- package/dist/components/Entity/index.d.ts +2 -0
- package/dist/components/Entity/renderGuard.d.ts +8 -0
- package/dist/components/Entity/types/UIHooks.d.ts +42 -0
- package/dist/components/Entity/types/index.d.ts +6 -0
- package/dist/components/Invite/InviteRoute.d.ts +20 -0
- package/dist/components/Invite/index.d.ts +2 -0
- package/dist/components/Routes/AppRoutes.d.ts +11 -0
- package/dist/components/Routes/GraphCoreApp.d.ts +11 -0
- package/dist/components/Routes/GraphCoreRouter.d.ts +28 -0
- package/dist/components/Routes/pageCollisions.d.ts +12 -0
- package/dist/components/TopBar/TopBar.d.ts +31 -0
- package/dist/components/ViewEntity/CompositeView/CompositeBox.d.ts +5 -0
- package/dist/components/ViewEntity/CompositeView/CompositeHBox.d.ts +2 -0
- package/dist/components/ViewEntity/CompositeView/CompositeTabs.d.ts +2 -0
- package/dist/components/ViewEntity/CompositeView/CompositeVBox.d.ts +2 -0
- package/dist/components/ViewEntity/CompositeView/index.d.ts +8 -0
- package/dist/components/ViewEntity/CompositeView/panels.d.ts +30 -0
- package/dist/components/ViewEntity/EntityAttributes/EntityAttributesView.d.ts +2 -0
- package/dist/components/ViewEntity/EntityAttributes/index.d.ts +2 -0
- package/dist/components/ViewEntity/EntityIDE/EntityExplorer.d.ts +29 -0
- package/dist/components/ViewEntity/EntityIDE/EntityIDE.d.ts +15 -0
- package/dist/components/ViewEntity/EntityIDE/index.d.ts +1 -0
- package/dist/components/ViewEntity/ListEntity/ListView.d.ts +6 -0
- package/dist/components/ViewEntity/ViewGallery/ViewGallery.d.ts +2 -0
- package/dist/components/common/EntityPicker.d.ts +15 -0
- package/dist/components/common/ErrorBoundary.d.ts +15 -0
- package/dist/components/common/ForbiddenGhost.d.ts +9 -0
- package/dist/components/common/Notification.d.ts +9 -0
- package/dist/components/common/ViewTypePicker.d.ts +10 -0
- package/dist/graphcore-react-kernel.cjs.js +3 -0
- package/dist/graphcore-react-kernel.es.js +7946 -0
- package/dist/hooks/useAuth.d.ts +14 -0
- package/dist/hooks/useEntities.d.ts +6 -0
- package/dist/hooks/useServerRoutes.d.ts +8 -0
- package/dist/hooks/useWebSocketConsumer.d.ts +15 -0
- package/dist/index.d.ts +2 -0
- package/dist/lib/GraphCoreProvider.d.ts +43 -0
- package/dist/lib/index.d.ts +57 -0
- package/dist/lib/runtimeConfig.d.ts +22 -0
- package/dist/pages/definePage.d.ts +31 -0
- package/dist/registry/EntityIcon.d.ts +12 -0
- package/dist/registry/baseViews.d.ts +2 -0
- package/dist/registry/entityTypeIds.d.ts +16 -0
- package/dist/registry/registry-context.d.ts +3 -0
- package/dist/registry/viewRegistry.d.ts +25 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/state/accessEvents.d.ts +4 -0
- package/dist/state/authStore.d.ts +14 -0
- package/dist/state/deploymentStore.d.ts +3 -0
- package/dist/state/entityGraph/entityAccessors.d.ts +8 -0
- package/dist/state/entityGraph/entityGraph.d.ts +7 -0
- package/dist/state/entityGraph/hooks.d.ts +5 -0
- package/dist/state/entityGraph/index.d.ts +5 -0
- package/dist/state/entityGraph/store.d.ts +14 -0
- package/dist/state/entityGraph/types.d.ts +47 -0
- package/dist/state/graphCoreBridge/StrategyError.d.ts +11 -0
- package/dist/state/graphCoreBridge/bridge-context.d.ts +4 -0
- package/dist/state/graphCoreBridge/bridge.d.ts +3 -0
- package/dist/state/graphCoreBridge/hooks.d.ts +4 -0
- package/dist/state/graphCoreBridge/statusStore.d.ts +4 -0
- package/dist/state/graphCoreBridge/types.d.ts +29 -0
- package/dist/state/notificationStore.d.ts +15 -0
- package/dist/state/registryDirectoryStore.d.ts +14 -0
- package/dist/state/resyncEvents.d.ts +6 -0
- package/dist/state/useEntityQuery.d.ts +23 -0
- package/dist/state/views/viewScopes.d.ts +11 -0
- package/dist/style.css +2 -0
- package/dist/utils/StrategyRequestBuilder.d.ts +198 -0
- package/dist/utils/dragDropInterface.d.ts +81 -0
- package/dist/utils/entityPath.d.ts +14 -0
- package/dist/views/EntityView.d.ts +15 -0
- package/dist/views/ViewContext.d.ts +13 -0
- package/dist/views/defineView.d.ts +45 -0
- package/dist/views/position.d.ts +24 -0
- package/dist/views/useEntityTypeIds.d.ts +2 -0
- package/dist/views/useViewState.d.ts +22 -0
- package/package.json +71 -5
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A place as the agent frontend renders it for the signed-in user. */
|
|
2
|
+
export interface AgentPlace {
|
|
3
|
+
text: string;
|
|
4
|
+
version: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** `open(at)` through the agent frontend's `/mcp`, the same call an agent makes. */
|
|
7
|
+
export declare function openPlace(at: string): Promise<AgentPlace>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const entityApi: EntityApi;
|
|
2
|
+
declare class EntityApi {
|
|
3
|
+
/** Who `token` is on this deployment: issuer tokens carry no GraphCore ids. */
|
|
4
|
+
me(token: any): Promise<any>;
|
|
5
|
+
/** The deployment's unauthenticated identity document. */
|
|
6
|
+
getIdentity(): Promise<any>;
|
|
7
|
+
_authHeaders(): {
|
|
8
|
+
Authorization: string;
|
|
9
|
+
} | {
|
|
10
|
+
Authorization?: undefined;
|
|
11
|
+
};
|
|
12
|
+
/** `fetch` with the session's token, renewed once and retried on a 401. An injected token has no session to renew. */
|
|
13
|
+
_authorizedFetch(url: any, init?: {}): Promise<Response>;
|
|
14
|
+
getStrategyDirectory(): Promise<any>;
|
|
15
|
+
getRoutes(): Promise<any>;
|
|
16
|
+
getEntityDirectory(): Promise<any>;
|
|
17
|
+
/** Create an invite to `resourceId`; the returned `token` is the only copy of its secret. */
|
|
18
|
+
createInvite(resourceId: any, roleName: any, options?: {}): Promise<any>;
|
|
19
|
+
/** Redeem an invite token as the signed-in user: `{ resource_id, entity_type_id }`. */
|
|
20
|
+
redeemInvite(token: any): Promise<any>;
|
|
21
|
+
getAccess(resourceId: any): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* @param {{type_ids: string[], parent_id?: string, where?: object, granted_to_me?: boolean, cursor?: string|null, limit?: number}} options
|
|
24
|
+
* `where` is a predicate built with `api/predicate.ts`. `granted_to_me` keeps only
|
|
25
|
+
* entities granted to the caller or their groups, not to everyone.
|
|
26
|
+
*/
|
|
27
|
+
listEntities({ type_ids, parent_id, where, granted_to_me, cursor, limit }: {
|
|
28
|
+
type_ids: string[];
|
|
29
|
+
parent_id?: string;
|
|
30
|
+
where?: object;
|
|
31
|
+
granted_to_me?: boolean;
|
|
32
|
+
cursor?: string | null;
|
|
33
|
+
limit?: number;
|
|
34
|
+
}): Promise<any>;
|
|
35
|
+
getEntity(entityId: any, token: any): Promise<any>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builders for the predicate wire encoding accepted as `where` by
|
|
3
|
+
* `/api/list_entities/` and `/api/referrers/`
|
|
4
|
+
* (persistence/ENTITY_REPOSITORY_TECHNICAL_TDD.md, Wire encoding).
|
|
5
|
+
*/
|
|
6
|
+
export type Scalar = string | number | boolean | null;
|
|
7
|
+
export type Predicate = {
|
|
8
|
+
equal: {
|
|
9
|
+
field: string;
|
|
10
|
+
value: Scalar;
|
|
11
|
+
};
|
|
12
|
+
} | {
|
|
13
|
+
in_values: {
|
|
14
|
+
field: string;
|
|
15
|
+
values: Scalar[];
|
|
16
|
+
};
|
|
17
|
+
} | {
|
|
18
|
+
contains_value: {
|
|
19
|
+
field: string;
|
|
20
|
+
value: Scalar;
|
|
21
|
+
};
|
|
22
|
+
} | {
|
|
23
|
+
contains_any: {
|
|
24
|
+
field: string;
|
|
25
|
+
values: Scalar[];
|
|
26
|
+
};
|
|
27
|
+
} | {
|
|
28
|
+
all_of: Predicate[];
|
|
29
|
+
} | {
|
|
30
|
+
any_of: Predicate[];
|
|
31
|
+
};
|
|
32
|
+
export declare const equal: (field: string, value: Scalar) => Predicate;
|
|
33
|
+
export declare const inValues: (field: string, values: Scalar[]) => Predicate;
|
|
34
|
+
export declare const containsValue: (field: string, value: Scalar) => Predicate;
|
|
35
|
+
export declare const containsAny: (field: string, values: Scalar[]) => Predicate;
|
|
36
|
+
export declare const allOf: (...predicates: Predicate[]) => Predicate;
|
|
37
|
+
export declare const anyOf: (...predicates: Predicate[]) => Predicate;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { User, UserManager } from 'oidc-client-ts';
|
|
2
|
+
export declare const CALLBACK_PATH = "/auth/callback";
|
|
3
|
+
export declare const SESSION_ENDED_MESSAGE = "Your session ended. Sign in again.";
|
|
4
|
+
/** A request refused because the session is over; the sign-in page already says so. */
|
|
5
|
+
export declare class SessionEndedError extends Error {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
export declare function getUserManager(): Promise<UserManager>;
|
|
9
|
+
export declare function isCallback(): boolean;
|
|
10
|
+
/** Whether the issuer advertises OIDC `prompt=create`, i.e. a registration page `startSignIn` can open. */
|
|
11
|
+
export declare function issuerOffersRegistration(): Promise<boolean>;
|
|
12
|
+
/** Finish a redirect sign-in and return to the page that started it. */
|
|
13
|
+
export declare function completeSignIn(): Promise<User>;
|
|
14
|
+
export declare function startSignIn(options?: {
|
|
15
|
+
createAccount?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
/** A stored session's user, renewed with its refresh token when the access token has expired. */
|
|
18
|
+
export declare function restoreUser(): Promise<User | null>;
|
|
19
|
+
/**
|
|
20
|
+
* A fresh access token for when the API has rejected the current one, or null
|
|
21
|
+
* when the session cannot be renewed. Background renewal runs on a timer that
|
|
22
|
+
* the browser pauses in sleeping or hidden tabs, so a request can find the
|
|
23
|
+
* token expired. Concurrent callers share one renewal.
|
|
24
|
+
*/
|
|
25
|
+
export declare function renewSession(): Promise<string | null>;
|
|
26
|
+
/** Renews when the stored access token has expired; false when it has not. */
|
|
27
|
+
export declare function renewIfExpired(): Promise<boolean>;
|
|
28
|
+
/** Calls `listener` when `renewSession` finds the session over. */
|
|
29
|
+
export declare function onSessionEnded(listener: () => void): () => void;
|
|
30
|
+
/** The user this page load starts with. Settled once per load: a callback's code is single-use. */
|
|
31
|
+
export declare function initialUser(): Promise<User | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Going Back to a page left for the issuer can restore it from the browser's
|
|
34
|
+
* back/forward cache with its in-flight state ("Please wait...") frozen and no
|
|
35
|
+
* code re-running. Calls `onRestore` then so the page can start over.
|
|
36
|
+
*/
|
|
37
|
+
export declare function onRestoredFromCache(onRestore: () => void): () => void;
|
|
38
|
+
export declare function signOut(): Promise<void>;
|
|
39
|
+
export declare function resetUserManagerForTests(): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SendStrategyRequest } from './useAccess';
|
|
2
|
+
export type AccessPanelProps = {
|
|
3
|
+
entityId: string;
|
|
4
|
+
sendStrategyRequest: SendStrategyRequest;
|
|
5
|
+
className?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function AccessPanel({ entityId, sendStrategyRequest, className, }: AccessPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GroupView: import('../../lib').DefinedView<{}>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { AccessPanel } from './AccessPanel';
|
|
2
|
+
export type { AccessPanelProps } from './AccessPanel';
|
|
3
|
+
export { GroupView } from './GroupView';
|
|
4
|
+
export { useAccess } from './useAccess';
|
|
5
|
+
export type { AccessGrant, AccessRole, AccessSummary, SendStrategyRequest, } from './useAccess';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export declare const PUBLIC_SUBJECT_ID = "*";
|
|
2
|
+
export type AccessRole = {
|
|
3
|
+
name: string;
|
|
4
|
+
permissions: string[];
|
|
5
|
+
};
|
|
6
|
+
export type AccessGrant = {
|
|
7
|
+
subject_id: string;
|
|
8
|
+
role: string;
|
|
9
|
+
provenance: string;
|
|
10
|
+
grant_entity_id?: string | null;
|
|
11
|
+
resource_id: string;
|
|
12
|
+
};
|
|
13
|
+
export type AccessSummary = {
|
|
14
|
+
resource_id: string;
|
|
15
|
+
can_manage: boolean;
|
|
16
|
+
grants: AccessGrant[];
|
|
17
|
+
};
|
|
18
|
+
export type SendStrategyRequest = (request: any, options?: {
|
|
19
|
+
awaitResponse?: boolean;
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}) => Promise<unknown> | void;
|
|
22
|
+
export declare function useAccess(entityId: string, sendStrategyRequest: SendStrategyRequest): {
|
|
23
|
+
summary: AccessSummary;
|
|
24
|
+
canManage: boolean;
|
|
25
|
+
grants: AccessGrant[];
|
|
26
|
+
shareable: boolean;
|
|
27
|
+
roles: AccessRole[];
|
|
28
|
+
publicPermissions: string[];
|
|
29
|
+
subjectTypeIds: string[];
|
|
30
|
+
subjectLabel: (entity: any) => string;
|
|
31
|
+
labelsById: Record<string, string>;
|
|
32
|
+
publicGrant: AccessGrant;
|
|
33
|
+
loading: boolean;
|
|
34
|
+
busy: boolean;
|
|
35
|
+
error: string;
|
|
36
|
+
refresh: () => Promise<void>;
|
|
37
|
+
grant: (subjectId: string, roleName: string) => Promise<void>;
|
|
38
|
+
changeRole: (grantId: string, roleName: string) => Promise<void>;
|
|
39
|
+
revoke: (grantId: string) => Promise<void>;
|
|
40
|
+
setPublicRead: () => Promise<void>;
|
|
41
|
+
revokePublicRead: () => Promise<void>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { SendStrategyRequest } from '../Access/useAccess';
|
|
2
|
+
/** The route the kernel suggests for AdminPanel. */
|
|
3
|
+
export declare const ADMIN_ROUTE = "/admin";
|
|
4
|
+
export type DeploymentRole = {
|
|
5
|
+
name: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
permissions: string[];
|
|
8
|
+
permission_details?: Array<{
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}>;
|
|
12
|
+
};
|
|
13
|
+
export type AdminPanelProps = {
|
|
14
|
+
sendStrategyRequest?: SendStrategyRequest;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Deployment administration: who belongs, which groups exist, what the
|
|
19
|
+
* deployment's roles allow, and what new users receive. Shown to members of
|
|
20
|
+
* `graphcore.admins`; see `graphcore docs distro/deployment-access`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function AdminPanel({ sendStrategyRequest: sendProp, className }: AdminPanelProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const AGENT_SETTLE_MS = 250;
|
|
3
|
+
export declare const AGENT_CHANGED_MS = 2000;
|
|
4
|
+
/** Whether pages offer the agent mirror; `GraphCoreProvider`'s `agentMirror` sets it. */
|
|
5
|
+
export declare const AgentMirrorEnabled: React.Context<boolean>;
|
|
6
|
+
export declare function setAgentMirrorOpen(open: boolean): void;
|
|
7
|
+
/**
|
|
8
|
+
* Wraps a page so it can show, beside itself, what an agent connected as the
|
|
9
|
+
* signed-in user reads at `address`. Renders `children` alone unless
|
|
10
|
+
* `GraphCoreProvider` was given `agentMirror`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function AgentMirror({ address, children }: {
|
|
13
|
+
address: string;
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AgentMirror, AgentMirrorEnabled } from './AgentMirror';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface AuthPageProps {
|
|
3
|
+
/** Override the default full-screen layout for inline embedding. */
|
|
4
|
+
className?: string;
|
|
5
|
+
/** The app's name above the sign-in prompt. Default `graphcore`. */
|
|
6
|
+
title?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Sends the user to the issuer to sign in or create an account; while a
|
|
10
|
+
* stored session is restored or a sign-in starts, it shows only a wait. The app
|
|
11
|
+
* reloads signed in; the parent's useAuth().isAuthenticated flip re-renders
|
|
12
|
+
* the gate.
|
|
13
|
+
*/
|
|
14
|
+
export declare const AuthPage: React.FC<AuthPageProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AuthPage } from './AuthPage';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* EntityRoute — mounted at `ENTITY_ROUTE` alongside `ViewGallery` at `/`.
|
|
4
|
+
* Renders the routed entity with `EntityView` as the page's view: a view (a
|
|
5
|
+
* gallery card) renders as itself, any other entity in the user's view of the page `/e/<id>`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EntityRoute: React.FC;
|
|
8
|
+
/**
|
|
9
|
+
* Catch-all that sends a pasted identifier to its entity route: `host/gc://…`
|
|
10
|
+
* (whose `//` the browser may collapse) and the old encoded single-segment
|
|
11
|
+
* links both land here. Anything else goes home.
|
|
12
|
+
*/
|
|
13
|
+
export declare const EntityLinkRedirect: React.FC;
|
|
14
|
+
export default EntityRoute;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare function useRenderPath(): string[];
|
|
3
|
+
interface RenderPathScopeProps {
|
|
4
|
+
token?: string | null;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare function RenderPathScope({ token, children }: RenderPathScopeProps): React.ReactElement;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIHooks Interface - Simple Callback Interface
|
|
3
|
+
*
|
|
4
|
+
* A clean interface for passing common UI callbacks from parent to child components.
|
|
5
|
+
* This eliminates the need for prop drilling of repetitive callback functions.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Parent defines callbacks
|
|
10
|
+
* const uiHooks: UIHooks = {
|
|
11
|
+
* onEntityOpen: (entityId) => openWindow(entityId),
|
|
12
|
+
* };
|
|
13
|
+
*
|
|
14
|
+
* <EntityExplorer entityId={id} uiHooks={uiHooks} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export interface UIHooks {
|
|
18
|
+
/**
|
|
19
|
+
* Called when an entity should be opened.
|
|
20
|
+
* Typically used to open the entity in a new window or navigate to it.
|
|
21
|
+
* @param entityId - The ID of the entity to open
|
|
22
|
+
*/
|
|
23
|
+
onEntityOpen?: (entityId: string, sourceEntityId?: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when an entity should be pinned to a persistent location (e.g., dock).
|
|
26
|
+
* @param entityId - The ID of the entity to pin
|
|
27
|
+
* @param sourceEntityId - The ID of the entity that triggered the pin (for positional context)
|
|
28
|
+
*/
|
|
29
|
+
onEntityPin?: (entityId: string, sourceEntityId?: string) => void;
|
|
30
|
+
/**
|
|
31
|
+
* Called when an entity is selected in an explorer/tree context.
|
|
32
|
+
* @param entityId - The ID of the entity selected
|
|
33
|
+
* @param sourceEntityId - The ID of the entity that triggered the selection (for positional context)
|
|
34
|
+
*/
|
|
35
|
+
onEntitySelect?: (entityId: string, sourceEntityId?: string) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Props interface for components that accept UIHooks
|
|
39
|
+
*/
|
|
40
|
+
export interface UIHooksProps {
|
|
41
|
+
uiHooks?: UIHooks;
|
|
42
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const INVITE_ROUTE = "/invite";
|
|
3
|
+
export type RedeemedInvite = {
|
|
4
|
+
resource_id: string;
|
|
5
|
+
entity_type_id: string;
|
|
6
|
+
};
|
|
7
|
+
export interface InviteRouteProps {
|
|
8
|
+
/** Called once the invite is redeemed. Default: open the resource's entity page. */
|
|
9
|
+
onRedeemed?: (invite: RedeemedInvite) => void;
|
|
10
|
+
/** The app's name on the invite page. Default `graphcore`. */
|
|
11
|
+
title?: string;
|
|
12
|
+
}
|
|
13
|
+
/** The link to share for an invite `token`. The token rides in the fragment, so it never reaches a server log. */
|
|
14
|
+
export declare function inviteUrl(token: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Mount at `INVITE_ROUTE`, outside any sign-in gate. Signed out, it offers
|
|
17
|
+
* sign-in (and registration where the issuer has a registration page);
|
|
18
|
+
* sign-in returns here with the token, and a signed-in visit redeems it.
|
|
19
|
+
*/
|
|
20
|
+
export declare function InviteRoute({ onRedeemed, title }: InviteRouteProps): React.JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The kernel's `/` (the registry's `home` view, else `ViewGallery`) and one
|
|
4
|
+
* route per entry of the server's route table. Mount it as the shell's
|
|
5
|
+
* catch-all; `fallback` renders for any other address once the table has
|
|
6
|
+
* loaded. `/e/…` is `EntityRoute`'s.
|
|
7
|
+
*/
|
|
8
|
+
export declare function AppRoutes({ fallback }: {
|
|
9
|
+
fallback?: React.ReactNode;
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
export default AppRoutes;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The default signed-in GraphCore app: the invite page at `INVITE_ROUTE`
|
|
4
|
+
* whether or not anyone is signed in, otherwise the sign-in page until a principal
|
|
5
|
+
* is signed in, then entity pages full-screen and everything else (home,
|
|
6
|
+
* admin, the server's route table) under the top bar. Pass your own layout
|
|
7
|
+
* to `GraphCoreRouter`'s `app` when this one does not fit.
|
|
8
|
+
*/
|
|
9
|
+
export declare function GraphCoreApp({ topBar }: {
|
|
10
|
+
topBar?: React.ReactNode;
|
|
11
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { GraphCoreProviderProps } from '../../lib/GraphCoreProvider';
|
|
3
|
+
import { ViewRegistry } from '../../registry/viewRegistry';
|
|
4
|
+
import { DefinedPage } from '../../pages/definePage';
|
|
5
|
+
/** `GraphCoreProvider`'s settings, minus what the router supplies itself. */
|
|
6
|
+
export type GraphCoreConfig = Omit<GraphCoreProviderProps, 'registry' | 'basePath' | 'children'>;
|
|
7
|
+
export interface GraphCoreRouterProps {
|
|
8
|
+
/** The views, from `createViewRegistry()`. */
|
|
9
|
+
registry: ViewRegistry;
|
|
10
|
+
/** Public pages, usually `collectPages(installedApps)`. */
|
|
11
|
+
pages?: DefinedPage[];
|
|
12
|
+
/** API and sign-in settings for the GraphCore app. */
|
|
13
|
+
config: GraphCoreConfig;
|
|
14
|
+
/** Where the GraphCore app is mounted, e.g. `/app`. Default `/`. */
|
|
15
|
+
basePath?: string;
|
|
16
|
+
/** The signed-in app's layout. Default `<GraphCoreApp />`. Always rendered inside `GraphCoreProvider`. */
|
|
17
|
+
app?: React.ReactNode;
|
|
18
|
+
/** Shown under a base path for a path that is neither a page nor the app. */
|
|
19
|
+
notFound?: React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A project's whole frontend: public pages, rendered with no provider and
|
|
23
|
+
* no session, and the GraphCore app at `basePath`, rendered inside
|
|
24
|
+
* `GraphCoreProvider`. Under a base path the app gets its own router with
|
|
25
|
+
* that basename, so its links and addresses are unchanged; moving between
|
|
26
|
+
* a page and the app is a full page load.
|
|
27
|
+
*/
|
|
28
|
+
export declare function GraphCoreRouter({ registry, pages, config, basePath: basePathProp, app, notFound, }: GraphCoreRouterProps): React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DefinedPage } from '../../pages/definePage';
|
|
2
|
+
/** Web paths the GraphCore app serves that are not in the server's route table. */
|
|
3
|
+
export declare const KERNEL_WEB_PATHS: string[];
|
|
4
|
+
/**
|
|
5
|
+
* Pages whose path can match an address the GraphCore app serves. Only
|
|
6
|
+
* possible when the app is mounted at the root: under a base path the two
|
|
7
|
+
* never share an address.
|
|
8
|
+
*/
|
|
9
|
+
export declare function pageCollisions(pages: DefinedPage[], serverPatterns: string[], basePath: string): Array<{
|
|
10
|
+
page: string;
|
|
11
|
+
route: string;
|
|
12
|
+
}>;
|