shred-api-client 2.9.1 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +38 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3497,6 +3497,15 @@ type ActionGroup = "Projects" | "Editors" | "Goals" | "Notes" | "Tenants" | "Off
|
|
|
3497
3497
|
type ActionMeta = {
|
|
3498
3498
|
label: string;
|
|
3499
3499
|
group: ActionGroup;
|
|
3500
|
+
/**
|
|
3501
|
+
* Whether this action is meaningful when scoped to a single tenant.
|
|
3502
|
+
* A role that contains at least one scopeable action can be assigned with
|
|
3503
|
+
* `scope: tenant:<id>`; roles made only of global capabilities (e.g. admin,
|
|
3504
|
+
* role management) can only be assigned globally.
|
|
3505
|
+
*
|
|
3506
|
+
* Add `scopeable: true` to any action that should become tenant-scoped later.
|
|
3507
|
+
*/
|
|
3508
|
+
scopeable?: boolean;
|
|
3500
3509
|
};
|
|
3501
3510
|
/** One catalog row as served to the admin UI (GET /actions). */
|
|
3502
3511
|
type ActionCatalogEntry = ActionMeta & {
|
|
@@ -3512,6 +3521,8 @@ type ActionCatalogEntry = ActionMeta & {
|
|
|
3512
3521
|
declare const ActionCatalog: Record<Action, ActionMeta>;
|
|
3513
3522
|
/** The catalog as a flat list of `{ key, label, group }` — e.g. for `GET /actions`. */
|
|
3514
3523
|
declare function listActionCatalog(): ActionCatalogEntry[];
|
|
3524
|
+
/** Whether an action is meaningful when scoped to a single tenant. */
|
|
3525
|
+
declare function isScopeable(action: Action): boolean;
|
|
3515
3526
|
|
|
3516
3527
|
declare const RoleSchema: z.ZodObject<{
|
|
3517
3528
|
id: z.ZodString;
|
|
@@ -3642,6 +3653,24 @@ declare const RoleAssignmentSchema: z.ZodObject<{
|
|
|
3642
3653
|
type RoleGrant = z.infer<typeof RoleGrantSchema>;
|
|
3643
3654
|
type RoleAssignment = z.infer<typeof RoleAssignmentSchema>;
|
|
3644
3655
|
|
|
3656
|
+
declare const PrincipalSchema: z.ZodObject<{
|
|
3657
|
+
uid: z.ZodString;
|
|
3658
|
+
email: z.ZodString;
|
|
3659
|
+
name: z.ZodString;
|
|
3660
|
+
disabled: z.ZodBoolean;
|
|
3661
|
+
}, "strip", z.ZodTypeAny, {
|
|
3662
|
+
email: string;
|
|
3663
|
+
name: string;
|
|
3664
|
+
uid: string;
|
|
3665
|
+
disabled: boolean;
|
|
3666
|
+
}, {
|
|
3667
|
+
email: string;
|
|
3668
|
+
name: string;
|
|
3669
|
+
uid: string;
|
|
3670
|
+
disabled: boolean;
|
|
3671
|
+
}>;
|
|
3672
|
+
type Principal = z.infer<typeof PrincipalSchema>;
|
|
3673
|
+
|
|
3645
3674
|
type CreateRoleInput = Omit<Role, "id">;
|
|
3646
3675
|
type UpdateRoleInput = Partial<Omit<Role, "id">>;
|
|
3647
3676
|
type AssignRoleInput = RoleGrant;
|
|
@@ -3654,6 +3683,7 @@ interface IAPI {
|
|
|
3654
3683
|
getAssignments: (c: Context, uid: string) => Promise<RoleAssignment | null>;
|
|
3655
3684
|
assign: (c: Context, uid: string, input: AssignRoleInput) => Promise<RoleAssignment>;
|
|
3656
3685
|
unassign: (c: Context, uid: string, input: AssignRoleInput) => Promise<RoleAssignment>;
|
|
3686
|
+
searchPrincipals: (c: Context, term: string) => Promise<Principal[]>;
|
|
3657
3687
|
}
|
|
3658
3688
|
declare const Endpoints: {
|
|
3659
3689
|
GetActions: {
|
|
@@ -3688,6 +3718,10 @@ declare const Endpoints: {
|
|
|
3688
3718
|
uri: string;
|
|
3689
3719
|
method: string;
|
|
3690
3720
|
};
|
|
3721
|
+
SearchPrincipals: {
|
|
3722
|
+
uri: string;
|
|
3723
|
+
method: string;
|
|
3724
|
+
};
|
|
3691
3725
|
};
|
|
3692
3726
|
|
|
3693
3727
|
type index$2_Action = Action;
|
|
@@ -3700,6 +3734,8 @@ type index$2_AssignRoleInput = AssignRoleInput;
|
|
|
3700
3734
|
type index$2_CreateRoleInput = CreateRoleInput;
|
|
3701
3735
|
declare const index$2_Endpoints: typeof Endpoints;
|
|
3702
3736
|
type index$2_IAPI = IAPI;
|
|
3737
|
+
type index$2_Principal = Principal;
|
|
3738
|
+
declare const index$2_PrincipalSchema: typeof PrincipalSchema;
|
|
3703
3739
|
type index$2_Role = Role;
|
|
3704
3740
|
type index$2_RoleAssignment = RoleAssignment;
|
|
3705
3741
|
declare const index$2_RoleAssignmentSchema: typeof RoleAssignmentSchema;
|
|
@@ -3709,9 +3745,10 @@ declare const index$2_RoleSchema: typeof RoleSchema;
|
|
|
3709
3745
|
type index$2_Scope = Scope;
|
|
3710
3746
|
declare const index$2_ScopeSchema: typeof ScopeSchema;
|
|
3711
3747
|
type index$2_UpdateRoleInput = UpdateRoleInput;
|
|
3748
|
+
declare const index$2_isScopeable: typeof isScopeable;
|
|
3712
3749
|
declare const index$2_listActionCatalog: typeof listActionCatalog;
|
|
3713
3750
|
declare namespace index$2 {
|
|
3714
|
-
export { type index$2_Action as Action, index$2_ActionCatalog as ActionCatalog, type index$2_ActionCatalogEntry as ActionCatalogEntry, type index$2_ActionGroup as ActionGroup, type index$2_ActionMeta as ActionMeta, index$2_Actions as Actions, type index$2_AssignRoleInput as AssignRoleInput, type index$2_CreateRoleInput as CreateRoleInput, index$2_Endpoints as Endpoints, type index$2_IAPI as IAPI, type index$2_Role as Role, type index$2_RoleAssignment as RoleAssignment, index$2_RoleAssignmentSchema as RoleAssignmentSchema, type index$2_RoleGrant as RoleGrant, index$2_RoleGrantSchema as RoleGrantSchema, index$2_RoleSchema as RoleSchema, type index$2_Scope as Scope, index$2_ScopeSchema as ScopeSchema, type index$2_UpdateRoleInput as UpdateRoleInput, index$2_listActionCatalog as listActionCatalog };
|
|
3751
|
+
export { type index$2_Action as Action, index$2_ActionCatalog as ActionCatalog, type index$2_ActionCatalogEntry as ActionCatalogEntry, type index$2_ActionGroup as ActionGroup, type index$2_ActionMeta as ActionMeta, index$2_Actions as Actions, type index$2_AssignRoleInput as AssignRoleInput, type index$2_CreateRoleInput as CreateRoleInput, index$2_Endpoints as Endpoints, type index$2_IAPI as IAPI, type index$2_Principal as Principal, index$2_PrincipalSchema as PrincipalSchema, type index$2_Role as Role, type index$2_RoleAssignment as RoleAssignment, index$2_RoleAssignmentSchema as RoleAssignmentSchema, type index$2_RoleGrant as RoleGrant, index$2_RoleGrantSchema as RoleGrantSchema, index$2_RoleSchema as RoleSchema, type index$2_Scope as Scope, index$2_ScopeSchema as ScopeSchema, type index$2_UpdateRoleInput as UpdateRoleInput, index$2_isScopeable as isScopeable, index$2_listActionCatalog as listActionCatalog };
|
|
3715
3752
|
}
|
|
3716
3753
|
|
|
3717
3754
|
declare class ShredAPI {
|
package/dist/index.js
CHANGED
|
@@ -6015,10 +6015,12 @@ __export(rbac_exports, {
|
|
|
6015
6015
|
ActionCatalog: () => ActionCatalog,
|
|
6016
6016
|
Actions: () => Actions,
|
|
6017
6017
|
Endpoints: () => Endpoints9,
|
|
6018
|
+
PrincipalSchema: () => PrincipalSchema,
|
|
6018
6019
|
RoleAssignmentSchema: () => RoleAssignmentSchema,
|
|
6019
6020
|
RoleGrantSchema: () => RoleGrantSchema,
|
|
6020
6021
|
RoleSchema: () => RoleSchema,
|
|
6021
6022
|
ScopeSchema: () => ScopeSchema,
|
|
6023
|
+
isScopeable: () => isScopeable,
|
|
6022
6024
|
listActionCatalog: () => listActionCatalog
|
|
6023
6025
|
});
|
|
6024
6026
|
|
|
@@ -6148,7 +6150,7 @@ var ActionCatalog = {
|
|
|
6148
6150
|
[Actions.TENANT_VIEW_MEMBERS]: { label: "View a tenant's members", group: "Tenants" },
|
|
6149
6151
|
[Actions.TENANT_UPDATE_MEMBERS]: { label: "Manage a tenant's members", group: "Tenants" },
|
|
6150
6152
|
[Actions.TENANT_UPDATE_REPORT_VIEWERS]: { label: "Manage a tenant's report viewers", group: "Tenants" },
|
|
6151
|
-
[Actions.TENANT_VIEW_REPORT]: { label: "View a tenant's report", group: "Tenants" },
|
|
6153
|
+
[Actions.TENANT_VIEW_REPORT]: { label: "View a tenant's report", group: "Tenants", scopeable: true },
|
|
6152
6154
|
[Actions.TENANT_VIEW_MINE]: { label: "View your own tenant", group: "Tenants" },
|
|
6153
6155
|
// Offers
|
|
6154
6156
|
[Actions.OFFER_LIST]: { label: "List all offers", group: "Offers" },
|
|
@@ -6193,6 +6195,10 @@ function listActionCatalog() {
|
|
|
6193
6195
|
...meta
|
|
6194
6196
|
}));
|
|
6195
6197
|
}
|
|
6198
|
+
function isScopeable(action) {
|
|
6199
|
+
var _a, _b;
|
|
6200
|
+
return (_b = (_a = ActionCatalog[action]) == null ? void 0 : _a.scopeable) != null ? _b : false;
|
|
6201
|
+
}
|
|
6196
6202
|
|
|
6197
6203
|
// src/model/rbac/Role.schema.ts
|
|
6198
6204
|
var RoleSchema = external_exports.object({
|
|
@@ -6215,6 +6221,14 @@ var RoleAssignmentSchema = external_exports.object({
|
|
|
6215
6221
|
roles: external_exports.array(RoleGrantSchema)
|
|
6216
6222
|
});
|
|
6217
6223
|
|
|
6224
|
+
// src/model/rbac/Principal.schema.ts
|
|
6225
|
+
var PrincipalSchema = external_exports.object({
|
|
6226
|
+
uid: external_exports.string(),
|
|
6227
|
+
email: external_exports.string(),
|
|
6228
|
+
name: external_exports.string(),
|
|
6229
|
+
disabled: external_exports.boolean()
|
|
6230
|
+
});
|
|
6231
|
+
|
|
6218
6232
|
// src/model/rbac/RBAC.api.ts
|
|
6219
6233
|
var Endpoints9 = {
|
|
6220
6234
|
GetActions: { uri: "/rbac/actions", method: "GET" },
|
|
@@ -6224,7 +6238,8 @@ var Endpoints9 = {
|
|
|
6224
6238
|
DeleteRole: { uri: "/rbac/roles/:roleId", method: "DELETE" },
|
|
6225
6239
|
GetAssignments: { uri: "/rbac/assignments/:uid", method: "GET" },
|
|
6226
6240
|
Assign: { uri: "/rbac/assignments/:uid", method: "POST" },
|
|
6227
|
-
Unassign: { uri: "/rbac/assignments/:uid", method: "DELETE" }
|
|
6241
|
+
Unassign: { uri: "/rbac/assignments/:uid", method: "DELETE" },
|
|
6242
|
+
SearchPrincipals: { uri: "/rbac/principals", method: "GET" }
|
|
6228
6243
|
};
|
|
6229
6244
|
|
|
6230
6245
|
// src/api/RBAC.api.ts
|
|
@@ -6277,6 +6292,11 @@ var RBACAPI = class {
|
|
|
6277
6292
|
const uri = e.uri.replace(":uid", uid);
|
|
6278
6293
|
return this.clientHTTP.makeRequest(this.env, uri, e.method, input, c, RoleAssignmentSchema);
|
|
6279
6294
|
}
|
|
6295
|
+
async searchPrincipals(c, term) {
|
|
6296
|
+
const e = Endpoints9.SearchPrincipals;
|
|
6297
|
+
const uri = `${e.uri}?q=${encodeURIComponent(term)}`;
|
|
6298
|
+
return this.clientHTTP.makeRequest(this.env, uri, e.method, null, c, external_exports.array(PrincipalSchema));
|
|
6299
|
+
}
|
|
6280
6300
|
};
|
|
6281
6301
|
var RBAC_api_default = RBACAPI;
|
|
6282
6302
|
|