@stapel/workspaces-react 0.7.0 → 0.9.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/CHANGELOG.md +42 -0
- package/dist/api/generated/schema.d.ts +497 -5
- package/dist/api/generated/schema.d.ts.map +1 -1
- package/dist/api/types.d.ts +91 -2
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/workspacesApi.d.ts +35 -1
- package/dist/api/workspacesApi.d.ts.map +1 -1
- package/dist/api/workspacesApi.js +20 -0
- package/dist/api/workspacesApi.js.map +1 -1
- package/dist/default/MembersManager.js +2 -2
- package/dist/i18n/generated/errors.gen.d.ts +6 -0
- package/dist/i18n/generated/errors.gen.d.ts.map +1 -1
- package/dist/i18n/generated/errors.gen.js +3 -0
- package/dist/i18n/generated/errors.gen.js.map +1 -1
- package/dist/i18n/generated/errors.ru.gen.d.ts.map +1 -1
- package/dist/i18n/generated/errors.ru.gen.js +1 -0
- package/dist/i18n/generated/errors.ru.gen.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/model/mutations.d.ts +86 -2
- package/dist/model/mutations.d.ts.map +1 -1
- package/dist/model/mutations.js +152 -1
- package/dist/model/mutations.js.map +1 -1
- package/dist/model/queries.d.ts +90 -2
- package/dist/model/queries.d.ts.map +1 -1
- package/dist/model/queries.js +115 -1
- package/dist/model/queries.js.map +1 -1
- package/dist/model/queryKeys.d.ts +11 -1
- package/dist/model/queryKeys.d.ts.map +1 -1
- package/dist/model/queryKeys.js +21 -1
- package/dist/model/queryKeys.js.map +1 -1
- package/dist/model/stepUp.d.ts +25 -0
- package/dist/model/stepUp.d.ts.map +1 -0
- package/dist/model/stepUp.js +79 -0
- package/dist/model/stepUp.js.map +1 -0
- package/llms.txt +15 -3
- package/manifest.json +147 -2
- package/package.json +4 -4
- package/src/analytics/generated/events.json +1 -1
- package/src/api/generated/schema.ts +497 -5
- package/src/api/types.ts +101 -2
- package/src/api/workspacesApi.ts +93 -0
- package/src/default/MembersManager.tsx +2 -2
- package/src/i18n/generated/errors.gen.ts +3 -0
- package/src/i18n/generated/errors.json +9 -0
- package/src/i18n/generated/errors.ru.gen.ts +1 -0
- package/src/index.ts +30 -2
- package/src/model/mutations.ts +193 -1
- package/src/model/queries.ts +162 -2
- package/src/model/queryKeys.ts +38 -2
- package/src/model/stepUp.ts +96 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { UseMutationResult } from "@tanstack/react-query";
|
|
2
2
|
import type { StapelApiError } from "@stapel/core";
|
|
3
|
-
import type { Member, MemberInvite, MemberInviteResult, InvitationAccept, InvitationClaim, Workspace, WorkspaceCreate, WorkspaceUpdate } from "../api/types.js";
|
|
3
|
+
import type { Invitation, Member, MemberInvite, MemberInviteResult, MemberPasswordReset, MemberPasswordResetResult, InvitationAccept, InvitationClaim, Workspace, WorkspaceCreate, WorkspaceSecuritySettings, WorkspaceUpdate } from "../api/types.js";
|
|
4
4
|
/**
|
|
5
|
-
* Write hooks (frontend-standard §2 —
|
|
5
|
+
* Write hooks (frontend-standard §2 — mutations invalidate on success). Each mutation
|
|
6
6
|
* invalidates exactly the server state it can move. Membership and ownership are
|
|
7
7
|
* server truth (roles gate access in other services via the membership cache),
|
|
8
8
|
* so NONE of these are optimistic (frontend-core-architecture §2.6: optimistic
|
|
@@ -49,6 +49,90 @@ export declare function useUpdateMemberRole(workspaceId: string): UseMutationRes
|
|
|
49
49
|
* variable is the member's `userId`. Refreshes the member list.
|
|
50
50
|
*/
|
|
51
51
|
export declare function useRemoveMember(workspaceId: string): UseMutationResult<void, StapelApiError, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Withdraw a live invitation (POST /{id}/invitations/{invitationId}/revoke,
|
|
54
|
+
* #109). The variable is the invitation id; the reply is the UPDATED row, so
|
|
55
|
+
* it is written straight into the page cache the table reads — a revoke is
|
|
56
|
+
* the mirror of the invitee's decline and both must stay distinguishable in
|
|
57
|
+
* `status`, which a blind refetch-and-hope would blur. Only a `pending`
|
|
58
|
+
* invitation is revocable: the backend answers
|
|
59
|
+
* `error.400.invitation_already_used` / `_revoked` / `_expired` otherwise
|
|
60
|
+
* (each its own key, not a shrug). Also refreshes the member list — the seat
|
|
61
|
+
* the invitation reserved is freed on commit.
|
|
62
|
+
*/
|
|
63
|
+
export declare function useRevokeInvitation(workspaceId: string): UseMutationResult<Invitation, StapelApiError, string>;
|
|
64
|
+
/**
|
|
65
|
+
* Send the invitation email again (POST /{id}/invitations/{invitationId}/resend,
|
|
66
|
+
* #109). The variable is the invitation id.
|
|
67
|
+
*
|
|
68
|
+
* This is NOT an idempotent "poke": the backend rotates the token and
|
|
69
|
+
* restarts the TTL, so every earlier link — including the one already in the
|
|
70
|
+
* invitee's inbox — stops working, and the row's `expires_at` moves. Hence
|
|
71
|
+
* the invalidation: a table still showing the old expiry would be lying about
|
|
72
|
+
* a live credential. An EXPIRED invitation is accepted on purpose (a dead TTL
|
|
73
|
+
* is the commonest reason to resend); reviving it re-reserves a seat, so a
|
|
74
|
+
* plan ceiling can answer 402 here.
|
|
75
|
+
*/
|
|
76
|
+
export declare function useResendInvitation(workspaceId: string): UseMutationResult<Invitation, StapelApiError, string>;
|
|
77
|
+
/** The variable for {@link useResetMemberPassword}: whose password, and the
|
|
78
|
+
* (optional) body — omit `password` to have the server generate one. */
|
|
79
|
+
export interface MemberPasswordResetVars {
|
|
80
|
+
readonly userId: string;
|
|
81
|
+
readonly body?: MemberPasswordReset;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Reset a member's password on the organization's order
|
|
85
|
+
* (POST /{id}/members/{userId}/password/reset, #110).
|
|
86
|
+
*
|
|
87
|
+
* **Step-up before the button.** Capability `members.password.reset` is
|
|
88
|
+
* declared `high`, so the backend wraps the endpoint in
|
|
89
|
+
* `requires_verification(scope="sensitive")`. Ask
|
|
90
|
+
* {@link "./queries.js".useCapabilityGate}(workspaceId,
|
|
91
|
+
* "members.password.reset") BEFORE offering the affordance: it answers both
|
|
92
|
+
* "may this caller" and "will a step-up be demanded". A step-up CHALLENGE is
|
|
93
|
+
* then driven by core's client and replayed transparently; the one case that
|
|
94
|
+
* is not transparent is the ENROLLMENT demand (the caller holds no factor to
|
|
95
|
+
* challenge) — read it off `error` with
|
|
96
|
+
* {@link "./stepUp.js".readVerificationEnrollment} and route to enrollment.
|
|
97
|
+
*
|
|
98
|
+
* **The one-shot credential.** `generated_password` comes back exactly once,
|
|
99
|
+
* only when the request omitted `password`, and can never be re-fetched. It
|
|
100
|
+
* is therefore deliberately kept OUT of the query cache: nothing here writes
|
|
101
|
+
* the response with `setQueryData`, and `gcTime: 0` drops the mutation result
|
|
102
|
+
* the moment the screen showing it unmounts. Writing it to a query would
|
|
103
|
+
* mean writing a live credential into every devtools panel AND into
|
|
104
|
+
* `localStorage`, because core's query runtime persists the whole per-user
|
|
105
|
+
* query cache (`createStapelQueryClient`). Hand it to the member out of band.
|
|
106
|
+
*
|
|
107
|
+
* Refreshes the member list (the reset moves the member's first-login state);
|
|
108
|
+
* a target that is not a resettable member of THIS workspace answers one
|
|
109
|
+
* byte-identical 404, never an existence oracle.
|
|
110
|
+
*/
|
|
111
|
+
export declare function useResetMemberPassword(workspaceId: string): UseMutationResult<MemberPasswordResetResult, StapelApiError, MemberPasswordResetVars>;
|
|
112
|
+
/**
|
|
113
|
+
* Update a workspace's SECURITY settings (the `security` block of
|
|
114
|
+
* `PATCH /{id}`, org-program §C3) — `require_mfa` and the first-login
|
|
115
|
+
* `provisioned_user_policies`.
|
|
116
|
+
*
|
|
117
|
+
* Separate from {@link useUpdateWorkspace} because the backend treats this
|
|
118
|
+
* block as a different endpoint in all but the URL: an extra capability
|
|
119
|
+
* (`workspace.security.manage`, declared `high`) plus a step-up on the same
|
|
120
|
+
* `sensitive` scope as the password reset, and turning `require_mfa` on
|
|
121
|
+
* sweeps the current members. See {@link useResetMemberPassword} for how to
|
|
122
|
+
* wire that in front of the control.
|
|
123
|
+
*
|
|
124
|
+
* `provisioned_user_policies` is a LIST since stapel-workspaces 0.13.0 (#90)
|
|
125
|
+
* — independent checkboxes, not alternatives. An explicit `[]` is a
|
|
126
|
+
* deliberate, auditable choice ("demand nothing"), so it is sent as such and
|
|
127
|
+
* never dropped as "empty means unset".
|
|
128
|
+
*
|
|
129
|
+
* MERGES, because the backend does not: `PATCH` assigns `settings` wholesale
|
|
130
|
+
* (`ws.settings = data.settings`), so sending a bare `{security: …}` would
|
|
131
|
+
* silently drop every other key the workspace holds. The merge reads the
|
|
132
|
+
* workspace fresh rather than trusting the detail cache — a stale snapshot
|
|
133
|
+
* here would resurrect settings somebody else has since removed.
|
|
134
|
+
*/
|
|
135
|
+
export declare function useUpdateSecuritySettings(workspaceId: string): UseMutationResult<Workspace, StapelApiError, WorkspaceSecuritySettings>;
|
|
52
136
|
/**
|
|
53
137
|
* Accept an invitation by its token — the caller joins the workspace. A dead
|
|
54
138
|
* token surfaces a localizable `StapelApiError` (`error.400.invitation_expired`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/model/mutations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EAChB,MAAM,iBAAiB,CAAC;AAIzB;;;;;;;;;;;GAWG;AAEH,wEAAwE;AACxE,wBAAgB,kBAAkB,IAAI,iBAAiB,CACrD,SAAS,EACT,cAAc,EACd,eAAe,CAChB,CAaA;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,eAAe,CAAC,CAiB/D;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,IAAI,iBAAiB,CACrD,IAAI,EACJ,cAAc,EACd,MAAM,CACP,CAeA;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAAC,kBAAkB,EAAE,cAAc,EAAE,YAAY,CAAC,CAgBrE;AAED;;;;gDAIgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAAC,MAAM,EAAE,cAAc,EAAE,gBAAgB,CAAC,CAa7D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,CAYjD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,iBAAiB,CACtD,MAAM,EACN,cAAc,EACd,gBAAgB,CACjB,CAgBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,iBAAiB,CACrD,eAAe,EACf,cAAc,EACd,MAAM,CACP,CAMA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CACvD,IAAI,EACJ,cAAc,EACd,MAAM,CACP,CAYA"}
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/model/mutations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EACV,UAAU,EACV,MAAM,EACN,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,gBAAg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M,WAAW,uBAAuB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAClB,yBAAyB,EACzB,cAAc,EACd,uBAAuB,CACxB,CAoBA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAAC,SAAS,EAAE,cAAc,EAAE,yBAAyB,CAAC,CAsCzE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,iBAAiB,CACtD,MAAM,EACN,cAAc,EACd,gBAAgB,CACjB,CAgBA;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,IAAI,iBAAiB,CACrD,eAAe,EACf,cAAc,EACd,MAAM,CACP,CAMA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CACvD,IAAI,EACJ,cAAc,EACd,MAAM,CACP,CAYA"}
|
package/dist/model/mutations.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
2
2
|
import { useWorkspacesApi } from "./context.js";
|
|
3
3
|
import { workspacesQueryKeys } from "./queryKeys.js";
|
|
4
4
|
/**
|
|
5
|
-
* Write hooks (frontend-standard §2 —
|
|
5
|
+
* Write hooks (frontend-standard §2 — mutations invalidate on success). Each mutation
|
|
6
6
|
* invalidates exactly the server state it can move. Membership and ownership are
|
|
7
7
|
* server truth (roles gate access in other services via the membership cache),
|
|
8
8
|
* so NONE of these are optimistic (frontend-core-architecture §2.6: optimistic
|
|
@@ -116,6 +116,157 @@ export function useRemoveMember(workspaceId) {
|
|
|
116
116
|
};
|
|
117
117
|
return useMutation(options);
|
|
118
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Withdraw a live invitation (POST /{id}/invitations/{invitationId}/revoke,
|
|
121
|
+
* #109). The variable is the invitation id; the reply is the UPDATED row, so
|
|
122
|
+
* it is written straight into the page cache the table reads — a revoke is
|
|
123
|
+
* the mirror of the invitee's decline and both must stay distinguishable in
|
|
124
|
+
* `status`, which a blind refetch-and-hope would blur. Only a `pending`
|
|
125
|
+
* invitation is revocable: the backend answers
|
|
126
|
+
* `error.400.invitation_already_used` / `_revoked` / `_expired` otherwise
|
|
127
|
+
* (each its own key, not a shrug). Also refreshes the member list — the seat
|
|
128
|
+
* the invitation reserved is freed on commit.
|
|
129
|
+
*/
|
|
130
|
+
export function useRevokeInvitation(workspaceId) {
|
|
131
|
+
const api = useWorkspacesApi();
|
|
132
|
+
const queryClient = useQueryClient();
|
|
133
|
+
const options = {
|
|
134
|
+
mutationFn: (invitationId) => api.revokeInvitation(workspaceId, invitationId),
|
|
135
|
+
onSuccess: () => {
|
|
136
|
+
void queryClient.invalidateQueries({
|
|
137
|
+
queryKey: workspacesQueryKeys.invitations(workspaceId),
|
|
138
|
+
});
|
|
139
|
+
void queryClient.invalidateQueries({
|
|
140
|
+
queryKey: workspacesQueryKeys.members(workspaceId),
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
return useMutation(options);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Send the invitation email again (POST /{id}/invitations/{invitationId}/resend,
|
|
148
|
+
* #109). The variable is the invitation id.
|
|
149
|
+
*
|
|
150
|
+
* This is NOT an idempotent "poke": the backend rotates the token and
|
|
151
|
+
* restarts the TTL, so every earlier link — including the one already in the
|
|
152
|
+
* invitee's inbox — stops working, and the row's `expires_at` moves. Hence
|
|
153
|
+
* the invalidation: a table still showing the old expiry would be lying about
|
|
154
|
+
* a live credential. An EXPIRED invitation is accepted on purpose (a dead TTL
|
|
155
|
+
* is the commonest reason to resend); reviving it re-reserves a seat, so a
|
|
156
|
+
* plan ceiling can answer 402 here.
|
|
157
|
+
*/
|
|
158
|
+
export function useResendInvitation(workspaceId) {
|
|
159
|
+
const api = useWorkspacesApi();
|
|
160
|
+
const queryClient = useQueryClient();
|
|
161
|
+
const options = {
|
|
162
|
+
mutationFn: (invitationId) => api.resendInvitation(workspaceId, invitationId),
|
|
163
|
+
onSuccess: () => {
|
|
164
|
+
void queryClient.invalidateQueries({
|
|
165
|
+
queryKey: workspacesQueryKeys.invitations(workspaceId),
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
return useMutation(options);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Reset a member's password on the organization's order
|
|
173
|
+
* (POST /{id}/members/{userId}/password/reset, #110).
|
|
174
|
+
*
|
|
175
|
+
* **Step-up before the button.** Capability `members.password.reset` is
|
|
176
|
+
* declared `high`, so the backend wraps the endpoint in
|
|
177
|
+
* `requires_verification(scope="sensitive")`. Ask
|
|
178
|
+
* {@link "./queries.js".useCapabilityGate}(workspaceId,
|
|
179
|
+
* "members.password.reset") BEFORE offering the affordance: it answers both
|
|
180
|
+
* "may this caller" and "will a step-up be demanded". A step-up CHALLENGE is
|
|
181
|
+
* then driven by core's client and replayed transparently; the one case that
|
|
182
|
+
* is not transparent is the ENROLLMENT demand (the caller holds no factor to
|
|
183
|
+
* challenge) — read it off `error` with
|
|
184
|
+
* {@link "./stepUp.js".readVerificationEnrollment} and route to enrollment.
|
|
185
|
+
*
|
|
186
|
+
* **The one-shot credential.** `generated_password` comes back exactly once,
|
|
187
|
+
* only when the request omitted `password`, and can never be re-fetched. It
|
|
188
|
+
* is therefore deliberately kept OUT of the query cache: nothing here writes
|
|
189
|
+
* the response with `setQueryData`, and `gcTime: 0` drops the mutation result
|
|
190
|
+
* the moment the screen showing it unmounts. Writing it to a query would
|
|
191
|
+
* mean writing a live credential into every devtools panel AND into
|
|
192
|
+
* `localStorage`, because core's query runtime persists the whole per-user
|
|
193
|
+
* query cache (`createStapelQueryClient`). Hand it to the member out of band.
|
|
194
|
+
*
|
|
195
|
+
* Refreshes the member list (the reset moves the member's first-login state);
|
|
196
|
+
* a target that is not a resettable member of THIS workspace answers one
|
|
197
|
+
* byte-identical 404, never an existence oracle.
|
|
198
|
+
*/
|
|
199
|
+
export function useResetMemberPassword(workspaceId) {
|
|
200
|
+
const api = useWorkspacesApi();
|
|
201
|
+
const queryClient = useQueryClient();
|
|
202
|
+
const options = {
|
|
203
|
+
mutationFn: ({ userId, body }) => api.resetMemberPassword(workspaceId, userId, body),
|
|
204
|
+
// The result carries a live credential: never retained past the screen
|
|
205
|
+
// that displays it, and never persisted.
|
|
206
|
+
gcTime: 0,
|
|
207
|
+
onSuccess: () => {
|
|
208
|
+
void queryClient.invalidateQueries({
|
|
209
|
+
queryKey: workspacesQueryKeys.members(workspaceId),
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
return useMutation(options);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Update a workspace's SECURITY settings (the `security` block of
|
|
217
|
+
* `PATCH /{id}`, org-program §C3) — `require_mfa` and the first-login
|
|
218
|
+
* `provisioned_user_policies`.
|
|
219
|
+
*
|
|
220
|
+
* Separate from {@link useUpdateWorkspace} because the backend treats this
|
|
221
|
+
* block as a different endpoint in all but the URL: an extra capability
|
|
222
|
+
* (`workspace.security.manage`, declared `high`) plus a step-up on the same
|
|
223
|
+
* `sensitive` scope as the password reset, and turning `require_mfa` on
|
|
224
|
+
* sweeps the current members. See {@link useResetMemberPassword} for how to
|
|
225
|
+
* wire that in front of the control.
|
|
226
|
+
*
|
|
227
|
+
* `provisioned_user_policies` is a LIST since stapel-workspaces 0.13.0 (#90)
|
|
228
|
+
* — independent checkboxes, not alternatives. An explicit `[]` is a
|
|
229
|
+
* deliberate, auditable choice ("demand nothing"), so it is sent as such and
|
|
230
|
+
* never dropped as "empty means unset".
|
|
231
|
+
*
|
|
232
|
+
* MERGES, because the backend does not: `PATCH` assigns `settings` wholesale
|
|
233
|
+
* (`ws.settings = data.settings`), so sending a bare `{security: …}` would
|
|
234
|
+
* silently drop every other key the workspace holds. The merge reads the
|
|
235
|
+
* workspace fresh rather than trusting the detail cache — a stale snapshot
|
|
236
|
+
* here would resurrect settings somebody else has since removed.
|
|
237
|
+
*/
|
|
238
|
+
export function useUpdateSecuritySettings(workspaceId) {
|
|
239
|
+
const api = useWorkspacesApi();
|
|
240
|
+
const queryClient = useQueryClient();
|
|
241
|
+
const options = {
|
|
242
|
+
mutationFn: async (patch) => {
|
|
243
|
+
const current = await api.getWorkspace(workspaceId);
|
|
244
|
+
const settings = (current.settings ?? {});
|
|
245
|
+
const security = (settings["security"] ?? {});
|
|
246
|
+
// `policies_configured` is derived and read-only on the wire — never
|
|
247
|
+
// sent back, whatever a caller spread into the patch.
|
|
248
|
+
const { policies_configured: _derived, ...writable } = {
|
|
249
|
+
...security,
|
|
250
|
+
...patch,
|
|
251
|
+
};
|
|
252
|
+
return api.updateWorkspace(workspaceId, {
|
|
253
|
+
settings: { ...settings, security: writable },
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
onSuccess: (updated) => {
|
|
257
|
+
queryClient.setQueryData(workspacesQueryKeys.detail(workspaceId), updated);
|
|
258
|
+
void queryClient.invalidateQueries({
|
|
259
|
+
queryKey: workspacesQueryKeys.list(),
|
|
260
|
+
});
|
|
261
|
+
// require_mfa ON suspends members without a strong factor; OFF lifts
|
|
262
|
+
// those suspensions. Either way the roster just moved.
|
|
263
|
+
void queryClient.invalidateQueries({
|
|
264
|
+
queryKey: workspacesQueryKeys.members(workspaceId),
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
return useMutation(options);
|
|
269
|
+
}
|
|
119
270
|
/**
|
|
120
271
|
* Accept an invitation by its token — the caller joins the workspace. A dead
|
|
121
272
|
* token surfaces a localizable `StapelApiError` (`error.400.invitation_expired`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/model/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/model/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAoBpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;GAWG;AAEH,wEAAwE;AACxE,MAAM,UAAU,kBAAkB;IAKhC,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GACX;QACE,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;QAC/C,SAAS,EAAE,GAAG,EAAE;YACd,KAAK,WAAW,CAAC,iBAAiB,CAAC;gBACjC,QAAQ,EAAE,mBAAmB,CAAC,IAAI,EAAE;aACrC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACJ,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,WAAmB;IAEnB,MAAM,GAAG,GAAG,gBAAgB,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GACX;QACE,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC;QAC9D,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE;YACrB,WAAW,CAAC,YAAY,CACtB,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,EACvC,OAAO,CACR,CAAC;YACF,KAAK,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,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,OAAO,GAAqD;QAChE,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC;QACnD,SAAS,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC5B,KAAK,WAAW,CAAC,iBAAiB,CAAC;gBACjC,QAAQ,EAAE,mBAAmB,CAAC,iBAAiB,CAAC,KAAK,CAAC;aACvD,CAAC,CAAC;QACL,CAAC;KACF,CAAC;IACF,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC"}
|
package/dist/model/queries.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { UseQueryResult } from "@tanstack/react-query";
|
|
1
|
+
import type { InfiniteData, UseInfiniteQueryResult, UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import type { StapelApiError } from "@stapel/core";
|
|
3
|
-
import type { InvitationPreview, MemberPage, MembersParams, RoleInfo, Workspace, WorkspaceList } from "../api/types.js";
|
|
3
|
+
import type { InvitationPage, InvitationPreview, InstanceShape, InvitationsParams, MemberPage, MembersParams, RoleInfo, Workspace, WorkspaceList } from "../api/types.js";
|
|
4
|
+
import type { CapabilityLevel } from "./stepUp.js";
|
|
4
5
|
/**
|
|
5
6
|
* Read hooks over the workspaces API. Staleness follows core's query defaults;
|
|
6
7
|
* override per call site via a page that needs fresher data. Keys are
|
|
@@ -34,6 +35,33 @@ export declare function useWorkspace(workspaceId: string | null): UseQueryResult
|
|
|
34
35
|
* to a specific page or filter; omit for the newest page (default limit 100).
|
|
35
36
|
*/
|
|
36
37
|
export declare function useMembers(workspaceId: string | null, params?: MembersParams): UseQueryResult<MemberPage, StapelApiError>;
|
|
38
|
+
/**
|
|
39
|
+
* One page of a workspace's invitations (GET /{id}/invitations, #109) — the
|
|
40
|
+
* admin's "who has not accepted yet" table. Disabled until a `workspaceId` is
|
|
41
|
+
* given (and the session is ready — see {@link useWorkspace}).
|
|
42
|
+
*
|
|
43
|
+
* ANCHOR pagination, exactly like {@link useMembers}: pass a page's
|
|
44
|
+
* `next_anchor` as `anchor` to walk forward. There is no page NUMBER — an
|
|
45
|
+
* offset would skew the moment an invitation is revoked or accepted while the
|
|
46
|
+
* admin is reading, which on this screen is the normal case, not the edge one.
|
|
47
|
+
* For scroll-to-load-more use {@link useInfiniteInvitations}.
|
|
48
|
+
*
|
|
49
|
+
* `status` defaults to the backend's `pending` (live, seat-reserving
|
|
50
|
+
* invitations); pass `never_accepted` to include declined/revoked/expired, or
|
|
51
|
+
* `all` for the full history.
|
|
52
|
+
*/
|
|
53
|
+
export declare function useInvitations(workspaceId: string | null, params?: InvitationsParams): UseQueryResult<InvitationPage, StapelApiError>;
|
|
54
|
+
/**
|
|
55
|
+
* A workspace's invitations as an infinite (load-more) list. Follows the
|
|
56
|
+
* backend's ANCHOR pagination and nothing else: the page param IS the
|
|
57
|
+
* previous page's `next_anchor`, and the walk stops when `has_next` goes
|
|
58
|
+
* false. `data.pages.flatMap(p => p.items)` is the flat row list.
|
|
59
|
+
*
|
|
60
|
+
* `filters` (`status` / `search` / `limit`) are part of the query key, so
|
|
61
|
+
* flipping the status tab starts a fresh anchor walk rather than appending
|
|
62
|
+
* rows of one filter to the pages of another.
|
|
63
|
+
*/
|
|
64
|
+
export declare function useInfiniteInvitations(workspaceId: string | null, filters?: Omit<InvitationsParams, "anchor" | "direction">): UseInfiniteQueryResult<InfiniteData<InvitationPage, string | undefined>, StapelApiError>;
|
|
37
65
|
/**
|
|
38
66
|
* The effective role registry (GET /roles, org-program §A2): builtin four +
|
|
39
67
|
* the deployment's `STAPEL_WORKSPACES["ROLES"]` overlay, capability strings
|
|
@@ -42,6 +70,24 @@ export declare function useMembers(workspaceId: string | null, params?: MembersP
|
|
|
42
70
|
* {@link useWorkspaces} (IsAuthenticated endpoint, mounts at screen top).
|
|
43
71
|
*/
|
|
44
72
|
export declare function useRoles(): UseQueryResult<readonly RoleInfo[], StapelApiError>;
|
|
73
|
+
/**
|
|
74
|
+
* Deployment shape (GET /instance, unauthenticated).
|
|
75
|
+
*
|
|
76
|
+
* Answers the question a screen must ask BEFORE deciding what to show
|
|
77
|
+
* someone with no workspace: is this a closed deployment (`landing:
|
|
78
|
+
* "none"` — no workspace exists and none can be created) or a public cloud
|
|
79
|
+
* (`"personal"` — one exists and the screen can lead there)?
|
|
80
|
+
*
|
|
81
|
+
* Why a hook instead of a profile field: the reader is exactly the person
|
|
82
|
+
* who has no access — kicked out of their workspace, or having left it. So
|
|
83
|
+
* the request deliberately does NOT wait for a session, unlike {@link
|
|
84
|
+
* useRoles}: waiting would mean never answering the one person it exists for.
|
|
85
|
+
*
|
|
86
|
+
* The data is static per deployment — it only changes alongside the
|
|
87
|
+
* deployment itself, so the cache lives until page reload and is never
|
|
88
|
+
* refetched.
|
|
89
|
+
*/
|
|
90
|
+
export declare function useInstanceShape(): UseQueryResult<InstanceShape, StapelApiError>;
|
|
45
91
|
/**
|
|
46
92
|
* Public invitation preview (GET /invitations/{token}, AllowAny — org-program
|
|
47
93
|
* §B2): what the `/invite/{token}` page renders BEFORE any auth decision.
|
|
@@ -70,4 +116,46 @@ export interface CapabilitiesResult {
|
|
|
70
116
|
* the backend predates the field.
|
|
71
117
|
*/
|
|
72
118
|
export declare function useCapabilities(workspaceId: string | null): CapabilitiesResult;
|
|
119
|
+
/** What {@link useCapabilityGate} answers about ONE capability, BEFORE the
|
|
120
|
+
* operation is attempted. */
|
|
121
|
+
export interface CapabilityGate {
|
|
122
|
+
/** The capability asked about, verbatim. */
|
|
123
|
+
readonly capability: string;
|
|
124
|
+
/** Does the caller's role carry it? Deny-by-default while loading. */
|
|
125
|
+
readonly allowed: boolean;
|
|
126
|
+
/** Its declared step-up level (ported registry — see `./stepUp.js`). */
|
|
127
|
+
readonly level: CapabilityLevel;
|
|
128
|
+
/** True when `level === "high"`: the backend ALSO demands a fresh
|
|
129
|
+
* verification (scope {@link SENSITIVE_SCOPE}) on top of the capability. */
|
|
130
|
+
readonly requiresStepUp: boolean;
|
|
131
|
+
/** The verification scope of that demand, or `null` at `standard`. */
|
|
132
|
+
readonly stepUpScope: string | null;
|
|
133
|
+
readonly isLoading: boolean;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Ask about one capability BEFORE offering the operation (org-program §A3).
|
|
137
|
+
*
|
|
138
|
+
* Two different answers, both needed in front of the button rather than
|
|
139
|
+
* behind it:
|
|
140
|
+
*
|
|
141
|
+
* * `allowed` — the caller's role carries the mandate. UI convenience only,
|
|
142
|
+
* deny-by-default; the backend re-checks. This is what replaces guessing
|
|
143
|
+
* access from the ROLE NAME: a deployment role like `secretary` can hold
|
|
144
|
+
* `members.invite` and would still fail a `role === "admin"` test forever,
|
|
145
|
+
* no matter what the registry says.
|
|
146
|
+
* * `requiresStepUp` — the operation is declared `high`, so a fresh step-up
|
|
147
|
+
* verification is demanded on top. Knowing this up front is what lets a
|
|
148
|
+
* screen say "you'll be asked to confirm" (or pre-drive enrollment)
|
|
149
|
+
* instead of showing a button that answers 403.
|
|
150
|
+
*
|
|
151
|
+
* Example — the administrative password reset:
|
|
152
|
+
* ```tsx
|
|
153
|
+
* const gate = useCapabilityGate(workspaceId, "members.password.reset");
|
|
154
|
+
* // gate.allowed === false → do not render the button at all
|
|
155
|
+
* // gate.requiresStepUp → render it with the "we will ask you to
|
|
156
|
+
* // confirm" affordance, wired to the app's
|
|
157
|
+
* // verification controller
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
export declare function useCapabilityGate(workspaceId: string | null, capability: string): CapabilityGate;
|
|
73
161
|
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/model/queries.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/model/queries.ts"],"names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8 +1,9 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1
|
+
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
|
|
2
2
|
import { useActiveSessionReady } from "@stapel/core";
|
|
3
3
|
import { useWorkspacesApi } from "./context.js";
|
|
4
4
|
import { workspacesQueryKeys } from "./queryKeys.js";
|
|
5
5
|
import { hasCapability } from "./capabilities.js";
|
|
6
|
+
import { SENSITIVE_SCOPE, capabilityLevel } from "./stepUp.js";
|
|
6
7
|
/**
|
|
7
8
|
* Read hooks over the workspaces API. Staleness follows core's query defaults;
|
|
8
9
|
* override per call site via a page that needs fresher data. Keys are
|
|
@@ -61,6 +62,57 @@ export function useMembers(workspaceId, params) {
|
|
|
61
62
|
enabled: sessionReady && workspaceId !== null && workspaceId !== "",
|
|
62
63
|
});
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* One page of a workspace's invitations (GET /{id}/invitations, #109) — the
|
|
67
|
+
* admin's "who has not accepted yet" table. Disabled until a `workspaceId` is
|
|
68
|
+
* given (and the session is ready — see {@link useWorkspace}).
|
|
69
|
+
*
|
|
70
|
+
* ANCHOR pagination, exactly like {@link useMembers}: pass a page's
|
|
71
|
+
* `next_anchor` as `anchor` to walk forward. There is no page NUMBER — an
|
|
72
|
+
* offset would skew the moment an invitation is revoked or accepted while the
|
|
73
|
+
* admin is reading, which on this screen is the normal case, not the edge one.
|
|
74
|
+
* For scroll-to-load-more use {@link useInfiniteInvitations}.
|
|
75
|
+
*
|
|
76
|
+
* `status` defaults to the backend's `pending` (live, seat-reserving
|
|
77
|
+
* invitations); pass `never_accepted` to include declined/revoked/expired, or
|
|
78
|
+
* `all` for the full history.
|
|
79
|
+
*/
|
|
80
|
+
export function useInvitations(workspaceId, params) {
|
|
81
|
+
const api = useWorkspacesApi();
|
|
82
|
+
const sessionReady = useActiveSessionReady();
|
|
83
|
+
const p = params ?? {};
|
|
84
|
+
return useQuery({
|
|
85
|
+
queryKey: workspacesQueryKeys.invitationsPage(workspaceId ?? "", p),
|
|
86
|
+
queryFn: () => api.listInvitations(workspaceId, p),
|
|
87
|
+
enabled: sessionReady && workspaceId !== null && workspaceId !== "",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A workspace's invitations as an infinite (load-more) list. Follows the
|
|
92
|
+
* backend's ANCHOR pagination and nothing else: the page param IS the
|
|
93
|
+
* previous page's `next_anchor`, and the walk stops when `has_next` goes
|
|
94
|
+
* false. `data.pages.flatMap(p => p.items)` is the flat row list.
|
|
95
|
+
*
|
|
96
|
+
* `filters` (`status` / `search` / `limit`) are part of the query key, so
|
|
97
|
+
* flipping the status tab starts a fresh anchor walk rather than appending
|
|
98
|
+
* rows of one filter to the pages of another.
|
|
99
|
+
*/
|
|
100
|
+
export function useInfiniteInvitations(workspaceId, filters) {
|
|
101
|
+
const api = useWorkspacesApi();
|
|
102
|
+
const sessionReady = useActiveSessionReady();
|
|
103
|
+
const f = filters ?? {};
|
|
104
|
+
return useInfiniteQuery({
|
|
105
|
+
queryKey: workspacesQueryKeys.invitationsInfinite(workspaceId ?? "", f),
|
|
106
|
+
queryFn: ({ pageParam }) => api.listInvitations(workspaceId, {
|
|
107
|
+
...f,
|
|
108
|
+
direction: "next",
|
|
109
|
+
...(pageParam !== undefined ? { anchor: pageParam } : {}),
|
|
110
|
+
}),
|
|
111
|
+
initialPageParam: undefined,
|
|
112
|
+
getNextPageParam: (last) => last.has_next ? (last.next_anchor ?? undefined) : undefined,
|
|
113
|
+
enabled: sessionReady && workspaceId !== null && workspaceId !== "",
|
|
114
|
+
});
|
|
115
|
+
}
|
|
64
116
|
/**
|
|
65
117
|
* The effective role registry (GET /roles, org-program §A2): builtin four +
|
|
66
118
|
* the deployment's `STAPEL_WORKSPACES["ROLES"]` overlay, capability strings
|
|
@@ -77,6 +129,31 @@ export function useRoles() {
|
|
|
77
129
|
enabled: sessionReady,
|
|
78
130
|
});
|
|
79
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Deployment shape (GET /instance, unauthenticated).
|
|
134
|
+
*
|
|
135
|
+
* Answers the question a screen must ask BEFORE deciding what to show
|
|
136
|
+
* someone with no workspace: is this a closed deployment (`landing:
|
|
137
|
+
* "none"` — no workspace exists and none can be created) or a public cloud
|
|
138
|
+
* (`"personal"` — one exists and the screen can lead there)?
|
|
139
|
+
*
|
|
140
|
+
* Why a hook instead of a profile field: the reader is exactly the person
|
|
141
|
+
* who has no access — kicked out of their workspace, or having left it. So
|
|
142
|
+
* the request deliberately does NOT wait for a session, unlike {@link
|
|
143
|
+
* useRoles}: waiting would mean never answering the one person it exists for.
|
|
144
|
+
*
|
|
145
|
+
* The data is static per deployment — it only changes alongside the
|
|
146
|
+
* deployment itself, so the cache lives until page reload and is never
|
|
147
|
+
* refetched.
|
|
148
|
+
*/
|
|
149
|
+
export function useInstanceShape() {
|
|
150
|
+
const api = useWorkspacesApi();
|
|
151
|
+
return useQuery({
|
|
152
|
+
queryKey: workspacesQueryKeys.instance(),
|
|
153
|
+
queryFn: () => api.getInstanceShape(),
|
|
154
|
+
staleTime: Infinity,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
80
157
|
/**
|
|
81
158
|
* Public invitation preview (GET /invitations/{token}, AllowAny — org-program
|
|
82
159
|
* §B2): what the `/invite/{token}` page renders BEFORE any auth decision.
|
|
@@ -109,4 +186,41 @@ export function useCapabilities(workspaceId) {
|
|
|
109
186
|
error: query.error ?? null,
|
|
110
187
|
};
|
|
111
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Ask about one capability BEFORE offering the operation (org-program §A3).
|
|
191
|
+
*
|
|
192
|
+
* Two different answers, both needed in front of the button rather than
|
|
193
|
+
* behind it:
|
|
194
|
+
*
|
|
195
|
+
* * `allowed` — the caller's role carries the mandate. UI convenience only,
|
|
196
|
+
* deny-by-default; the backend re-checks. This is what replaces guessing
|
|
197
|
+
* access from the ROLE NAME: a deployment role like `secretary` can hold
|
|
198
|
+
* `members.invite` and would still fail a `role === "admin"` test forever,
|
|
199
|
+
* no matter what the registry says.
|
|
200
|
+
* * `requiresStepUp` — the operation is declared `high`, so a fresh step-up
|
|
201
|
+
* verification is demanded on top. Knowing this up front is what lets a
|
|
202
|
+
* screen say "you'll be asked to confirm" (or pre-drive enrollment)
|
|
203
|
+
* instead of showing a button that answers 403.
|
|
204
|
+
*
|
|
205
|
+
* Example — the administrative password reset:
|
|
206
|
+
* ```tsx
|
|
207
|
+
* const gate = useCapabilityGate(workspaceId, "members.password.reset");
|
|
208
|
+
* // gate.allowed === false → do not render the button at all
|
|
209
|
+
* // gate.requiresStepUp → render it with the "we will ask you to
|
|
210
|
+
* // confirm" affordance, wired to the app's
|
|
211
|
+
* // verification controller
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
export function useCapabilityGate(workspaceId, capability) {
|
|
215
|
+
const { can, isLoading } = useCapabilities(workspaceId);
|
|
216
|
+
const level = capabilityLevel(capability);
|
|
217
|
+
return {
|
|
218
|
+
capability,
|
|
219
|
+
allowed: can(capability),
|
|
220
|
+
level,
|
|
221
|
+
requiresStepUp: level === "high",
|
|
222
|
+
stepUpScope: level === "high" ? SENSITIVE_SCOPE : null,
|
|
223
|
+
isLoading,
|
|
224
|
+
};
|
|
225
|
+
}
|
|
112
226
|
//# sourceMappingURL=queries.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/model/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/model/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAarD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,E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AoB,CAAC,KAAe,CAAC;QACxD,OAAO,EAAE,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;KACxC,CAAC,CAAC;AACL,CAAC;AAgBD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,WAA0B;IACxD,MAAM,KAAK,GAAG,YAAY,CAAC,WAAW,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,EAAE,eAAe,IAAI,EAAE,CAAC;IACvD,OAAO;QACL,YAAY;QACZ,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,UAAU,CAAC;QAC5D,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;KAC3B,CAAC;AACJ,CAAC;AAmBD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,iBAAiB,CAC/B,WAA0B,EAC1B,UAAkB;IAElB,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;IACxD,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC1C,OAAO;QACL,UAAU;QACV,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC;QACxB,KAAK;QACL,cAAc,EAAE,KAAK,KAAK,MAAM;QAChC,WAAW,EAAE,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,IAAI;QACtD,SAAS;KACV,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
|
-
import type { MembersParams } from "../api/types.js";
|
|
1
|
+
import type { InvitationsParams, MembersParams } from "../api/types.js";
|
|
2
2
|
export declare const workspacesQueryKeys: {
|
|
3
3
|
readonly all: readonly ["workspaces"];
|
|
4
4
|
list(): readonly ["workspaces", "list"];
|
|
5
5
|
detail(workspaceId: string): readonly ["workspaces", "detail", string];
|
|
6
6
|
members(workspaceId: string): readonly ["workspaces", "members", string];
|
|
7
7
|
membersPage(workspaceId: string, params: MembersParams): readonly ["workspaces", "members", string, MembersParams];
|
|
8
|
+
invitations(workspaceId: string): readonly ["workspaces", "invitations", string];
|
|
9
|
+
invitationsPage(workspaceId: string, params: InvitationsParams): readonly ["workspaces", "invitations", string, InvitationsParams];
|
|
10
|
+
invitationsInfinite(workspaceId: string, filters: InvitationsParams): readonly [
|
|
11
|
+
"workspaces",
|
|
12
|
+
"invitations",
|
|
13
|
+
string,
|
|
14
|
+
"infinite",
|
|
15
|
+
InvitationsParams
|
|
16
|
+
];
|
|
8
17
|
roles(): readonly ["workspaces", "roles"];
|
|
18
|
+
instance(): readonly ["workspaces", "instance"];
|
|
9
19
|
invitationPreview(token: string): readonly ["workspaces", "invitation-preview", string];
|
|
10
20
|
};
|
|
11
21
|
//# sourceMappingURL=queryKeys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../src/model/queryKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../src/model/queryKeys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAWxE,eAAO,MAAM,mBAAmB,EAAE;IAChC,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACtC,IAAI,IAAI,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IACxC,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACvE,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC,YAAY,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