shred-api-client 2.9.0 → 2.9.2

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 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;
@@ -3709,9 +3720,10 @@ declare const index$2_RoleSchema: typeof RoleSchema;
3709
3720
  type index$2_Scope = Scope;
3710
3721
  declare const index$2_ScopeSchema: typeof ScopeSchema;
3711
3722
  type index$2_UpdateRoleInput = UpdateRoleInput;
3723
+ declare const index$2_isScopeable: typeof isScopeable;
3712
3724
  declare const index$2_listActionCatalog: typeof listActionCatalog;
3713
3725
  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 };
3726
+ 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_isScopeable as isScopeable, index$2_listActionCatalog as listActionCatalog };
3715
3727
  }
3716
3728
 
3717
3729
  declare class ShredAPI {
package/dist/index.js CHANGED
@@ -6019,6 +6019,7 @@ __export(rbac_exports, {
6019
6019
  RoleGrantSchema: () => RoleGrantSchema,
6020
6020
  RoleSchema: () => RoleSchema,
6021
6021
  ScopeSchema: () => ScopeSchema,
6022
+ isScopeable: () => isScopeable,
6022
6023
  listActionCatalog: () => listActionCatalog
6023
6024
  });
6024
6025
 
@@ -6106,84 +6107,85 @@ var Actions = {
6106
6107
  USER_ASSIGN_ROLE: "user.assign_role"
6107
6108
  };
6108
6109
  var ActionCatalog = {
6109
- // Projects
6110
- [Actions.PROJECT_APPROVE]: { label: "Approve project", group: "Projects" },
6111
- [Actions.PROJECT_DENY]: { label: "Deny project", group: "Projects" },
6112
- [Actions.PROJECT_ASSIGN]: { label: "Assign project", group: "Projects" },
6113
- [Actions.PROJECT_ROLLBACK]: { label: "Rollback project", group: "Projects" },
6114
- [Actions.PROJECT_SCHEDULE]: { label: "Schedule project", group: "Projects" },
6115
- [Actions.PROJECT_UNSCHEDULE]: { label: "Unschedule project", group: "Projects" },
6116
- [Actions.PROJECT_GET_NEXT_IN_QUEUE]: { label: "Get next project in queue", group: "Projects" },
6117
- [Actions.PROJECT_VIEW_ALL]: { label: "View all projects", group: "Projects" },
6118
- [Actions.PROJECT_VIEW_HISTORY]: { label: "View project history", group: "Projects" },
6119
- [Actions.PROJECT_START]: { label: "Start project (pull from pool)", group: "Projects" },
6120
- [Actions.PROJECT_SEND_TO_APPROVAL]: { label: "Send project to approval", group: "Projects" },
6121
- [Actions.PROJECT_VIEW_POOL]: { label: "View pool size", group: "Projects" },
6122
- [Actions.PROJECT_STREAM]: { label: "Stream projects (realtime)", group: "Projects" },
6123
- [Actions.PROJECT_CREATE]: { label: "Create project", group: "Projects" },
6124
- [Actions.PROJECT_CANCEL]: { label: "Cancel project", group: "Projects" },
6125
- [Actions.PROJECT_REORDER]: { label: "Reorder projects", group: "Projects" },
6126
- [Actions.PROJECT_REQUEST_REVIEW]: { label: "Request project review", group: "Projects" },
6127
- [Actions.PROJECT_RECORD_INTERACTION]: { label: "Record project interaction", group: "Projects" },
6128
- [Actions.PROJECT_CHECK_FREE_QUOTA]: { label: "Check free project quota", group: "Projects" },
6129
- [Actions.PROJECT_LIST_OWN]: { label: "List own projects", group: "Projects" },
6130
- [Actions.PROJECT_VIEW_OWN]: { label: "View own project", group: "Projects" },
6131
- // Editors
6132
- [Actions.EDITOR_LIST]: { label: "List editors", group: "Editors" },
6133
- [Actions.EDITOR_GET]: { label: "View editor", group: "Editors" },
6110
+ // Projects (staff)
6111
+ [Actions.PROJECT_APPROVE]: { label: "Approve a project", group: "Projects" },
6112
+ [Actions.PROJECT_DENY]: { label: "Deny a project", group: "Projects" },
6113
+ [Actions.PROJECT_ASSIGN]: { label: "Assign a project to an editor", group: "Projects" },
6114
+ [Actions.PROJECT_ROLLBACK]: { label: "Roll back a project", group: "Projects" },
6115
+ [Actions.PROJECT_SCHEDULE]: { label: "Schedule a project", group: "Projects" },
6116
+ [Actions.PROJECT_UNSCHEDULE]: { label: "Unschedule a project", group: "Projects" },
6117
+ [Actions.PROJECT_GET_NEXT_IN_QUEUE]: { label: "Pull the next project from the queue", group: "Projects" },
6118
+ [Actions.PROJECT_VIEW_ALL]: { label: "View all projects (any user)", group: "Projects" },
6119
+ [Actions.PROJECT_VIEW_HISTORY]: { label: "View any project's history", group: "Projects" },
6120
+ [Actions.PROJECT_START]: { label: "Start a project (pull from pool)", group: "Projects" },
6121
+ [Actions.PROJECT_SEND_TO_APPROVAL]: { label: "Send a project to approval", group: "Projects" },
6122
+ [Actions.PROJECT_VIEW_POOL]: { label: "View the project pool size", group: "Projects" },
6123
+ [Actions.PROJECT_STREAM]: { label: "Stream projects in realtime", group: "Projects" },
6124
+ // Projects (customer self-service)
6125
+ [Actions.PROJECT_CREATE]: { label: "Create your own project", group: "Projects" },
6126
+ [Actions.PROJECT_CANCEL]: { label: "Cancel your own project", group: "Projects" },
6127
+ [Actions.PROJECT_REORDER]: { label: "Reorder your own projects", group: "Projects" },
6128
+ [Actions.PROJECT_REQUEST_REVIEW]: { label: "Request a review on your own project", group: "Projects" },
6129
+ [Actions.PROJECT_RECORD_INTERACTION]: { label: "Record an interaction on your own project", group: "Projects" },
6130
+ [Actions.PROJECT_CHECK_FREE_QUOTA]: { label: "Check your own free-project quota", group: "Projects" },
6131
+ [Actions.PROJECT_LIST_OWN]: { label: "List your own projects", group: "Projects" },
6132
+ [Actions.PROJECT_VIEW_OWN]: { label: "View your own project", group: "Projects" },
6133
+ // Editors (staff)
6134
+ [Actions.EDITOR_LIST]: { label: "List all editors", group: "Editors" },
6135
+ [Actions.EDITOR_GET]: { label: "View any editor", group: "Editors" },
6134
6136
  // Goals
6135
- [Actions.GOAL_VIEW_OWN]: { label: "View own goals", group: "Goals" },
6136
- [Actions.GOAL_VIEW_EDITOR]: { label: "View editor goals", group: "Goals" },
6137
- // Notes
6138
- [Actions.NOTE_VIEW]: { label: "View notes", group: "Notes" },
6139
- [Actions.NOTE_CREATE]: { label: "Create note", group: "Notes" },
6140
- [Actions.NOTE_UPDATE]: { label: "Update note", group: "Notes" },
6141
- [Actions.NOTE_DELETE]: { label: "Delete note", group: "Notes" },
6137
+ [Actions.GOAL_VIEW_OWN]: { label: "View your own goals", group: "Goals" },
6138
+ [Actions.GOAL_VIEW_EDITOR]: { label: "View any editor's goals", group: "Goals" },
6139
+ // Notes (staff notes about users)
6140
+ [Actions.NOTE_VIEW]: { label: "View a user's notes", group: "Notes" },
6141
+ [Actions.NOTE_CREATE]: { label: "Add a note to a user", group: "Notes" },
6142
+ [Actions.NOTE_UPDATE]: { label: "Edit a user note", group: "Notes" },
6143
+ [Actions.NOTE_DELETE]: { label: "Delete a user note", group: "Notes" },
6142
6144
  // Tenants
6143
- [Actions.TENANT_CREATE]: { label: "Create tenant", group: "Tenants" },
6144
- [Actions.TENANT_LIST]: { label: "List tenants", group: "Tenants" },
6145
- [Actions.TENANT_VIEW]: { label: "View tenant", group: "Tenants" },
6146
- [Actions.TENANT_UPDATE]: { label: "Update tenant", group: "Tenants" },
6147
- [Actions.TENANT_VIEW_MEMBERS]: { label: "View tenant members", group: "Tenants" },
6148
- [Actions.TENANT_UPDATE_MEMBERS]: { label: "Update tenant members", group: "Tenants" },
6149
- [Actions.TENANT_UPDATE_REPORT_VIEWERS]: { label: "Update tenant report viewers", group: "Tenants" },
6150
- [Actions.TENANT_VIEW_REPORT]: { label: "View tenant report", group: "Tenants" },
6151
- [Actions.TENANT_VIEW_MINE]: { label: "View my tenant", group: "Tenants" },
6145
+ [Actions.TENANT_CREATE]: { label: "Create a tenant", group: "Tenants" },
6146
+ [Actions.TENANT_LIST]: { label: "List all tenants", group: "Tenants" },
6147
+ [Actions.TENANT_VIEW]: { label: "View any tenant", group: "Tenants" },
6148
+ [Actions.TENANT_UPDATE]: { label: "Update any tenant", group: "Tenants" },
6149
+ [Actions.TENANT_VIEW_MEMBERS]: { label: "View a tenant's members", group: "Tenants" },
6150
+ [Actions.TENANT_UPDATE_MEMBERS]: { label: "Manage a tenant's members", group: "Tenants" },
6151
+ [Actions.TENANT_UPDATE_REPORT_VIEWERS]: { label: "Manage a tenant's report viewers", group: "Tenants" },
6152
+ [Actions.TENANT_VIEW_REPORT]: { label: "View a tenant's report", group: "Tenants", scopeable: true },
6153
+ [Actions.TENANT_VIEW_MINE]: { label: "View your own tenant", group: "Tenants" },
6152
6154
  // Offers
6153
- [Actions.OFFER_LIST]: { label: "List offers", group: "Offers" },
6154
- [Actions.OFFER_CREATE]: { label: "Create offer", group: "Offers" },
6155
- [Actions.OFFER_UPDATE]: { label: "Update offer", group: "Offers" },
6156
- [Actions.OFFER_ENABLE]: { label: "Enable offer", group: "Offers" },
6157
- [Actions.OFFER_DISABLE]: { label: "Disable offer", group: "Offers" },
6158
- [Actions.OFFER_GET_MINE]: { label: "View my offer", group: "Offers" },
6159
- [Actions.OFFER_CLAIM]: { label: "Claim offer", group: "Offers" },
6155
+ [Actions.OFFER_LIST]: { label: "List all offers", group: "Offers" },
6156
+ [Actions.OFFER_CREATE]: { label: "Create an offer", group: "Offers" },
6157
+ [Actions.OFFER_UPDATE]: { label: "Update an offer", group: "Offers" },
6158
+ [Actions.OFFER_ENABLE]: { label: "Enable an offer", group: "Offers" },
6159
+ [Actions.OFFER_DISABLE]: { label: "Disable an offer", group: "Offers" },
6160
+ [Actions.OFFER_GET_MINE]: { label: "View your own offer", group: "Offers" },
6161
+ [Actions.OFFER_CLAIM]: { label: "Claim your own offer", group: "Offers" },
6160
6162
  // Subscriptions
6161
- [Actions.SUBSCRIPTION_VIEW_USER]: { label: "View user subscription", group: "Subscriptions" },
6162
- [Actions.SUBSCRIPTION_VIEW_SUMMARY]: { label: "View subscription summary", group: "Subscriptions" },
6163
+ [Actions.SUBSCRIPTION_VIEW_USER]: { label: "View a user's subscription", group: "Subscriptions" },
6164
+ [Actions.SUBSCRIPTION_VIEW_SUMMARY]: { label: "View a user's subscription summary", group: "Subscriptions" },
6163
6165
  [Actions.SUBSCRIPTION_LIST_PROMO_CODES]: { label: "List promo codes", group: "Subscriptions" },
6164
- [Actions.SUBSCRIPTION_CHECKOUT]: { label: "Checkout subscription", group: "Subscriptions" },
6165
- [Actions.SUBSCRIPTION_PORTAL]: { label: "Open subscription portal", group: "Subscriptions" },
6166
- [Actions.SUBSCRIPTION_VIEW_ACTIVE]: { label: "View active subscription", group: "Subscriptions" },
6166
+ [Actions.SUBSCRIPTION_CHECKOUT]: { label: "Start your own checkout", group: "Subscriptions" },
6167
+ [Actions.SUBSCRIPTION_PORTAL]: { label: "Open your own billing portal", group: "Subscriptions" },
6168
+ [Actions.SUBSCRIPTION_VIEW_ACTIVE]: { label: "View your own active subscription", group: "Subscriptions" },
6167
6169
  [Actions.SUBSCRIPTION_LIST_PRODUCTS]: { label: "List subscription products", group: "Subscriptions" },
6168
- // Scripts
6169
- [Actions.SCRIPT_LIST]: { label: "List scripts", group: "Scripts" },
6170
- [Actions.SCRIPT_CREATE]: { label: "Create script", group: "Scripts" },
6171
- [Actions.SCRIPT_UPDATE]: { label: "Update script", group: "Scripts" },
6172
- [Actions.SCRIPT_DELETE]: { label: "Delete script", group: "Scripts" },
6173
- [Actions.SCRIPT_GENERATE]: { label: "Generate script", group: "Scripts" },
6170
+ // Scripts (customer self-service)
6171
+ [Actions.SCRIPT_LIST]: { label: "List your own scripts", group: "Scripts" },
6172
+ [Actions.SCRIPT_CREATE]: { label: "Create your own script", group: "Scripts" },
6173
+ [Actions.SCRIPT_UPDATE]: { label: "Update your own script", group: "Scripts" },
6174
+ [Actions.SCRIPT_DELETE]: { label: "Delete your own script", group: "Scripts" },
6175
+ [Actions.SCRIPT_GENERATE]: { label: "Generate a script", group: "Scripts" },
6174
6176
  // Prompts
6175
- [Actions.PROMPT_GET]: { label: "Get prompt", group: "Prompts" },
6177
+ [Actions.PROMPT_GET]: { label: "Get a prompt", group: "Prompts" },
6176
6178
  // Email
6177
- [Actions.EMAIL_SEND]: { label: "Send email", group: "Email" },
6179
+ [Actions.EMAIL_SEND]: { label: "Send an email", group: "Email" },
6178
6180
  // Users
6179
- [Actions.USER_SEARCH]: { label: "Search users", group: "Users" },
6180
- [Actions.USER_UPDATE]: { label: "Update own profile", group: "Users" },
6181
- [Actions.USER_DELETE]: { label: "Delete own account", group: "Users" },
6182
- [Actions.USER_CHANGE_EMAIL]: { label: "Change own email", group: "Users" },
6183
- [Actions.USER_GET_TOKEN]: { label: "Get API token", group: "Users" },
6184
- [Actions.USER_CREATE_TOKEN]: { label: "Create API token", group: "Users" },
6181
+ [Actions.USER_SEARCH]: { label: "Search all users", group: "Users" },
6182
+ [Actions.USER_UPDATE]: { label: "Update your own profile", group: "Users" },
6183
+ [Actions.USER_DELETE]: { label: "Delete your own account", group: "Users" },
6184
+ [Actions.USER_CHANGE_EMAIL]: { label: "Change your own email", group: "Users" },
6185
+ [Actions.USER_GET_TOKEN]: { label: "Get your own API token", group: "Users" },
6186
+ [Actions.USER_CREATE_TOKEN]: { label: "Create your own API token", group: "Users" },
6185
6187
  // Administration
6186
- [Actions.ROLE_MANAGE]: { label: "Manage roles", group: "Administration" },
6188
+ [Actions.ROLE_MANAGE]: { label: "Manage roles (create, edit, delete)", group: "Administration" },
6187
6189
  [Actions.USER_ASSIGN_ROLE]: { label: "Assign roles to users", group: "Administration" }
6188
6190
  };
6189
6191
  function listActionCatalog() {
@@ -6192,6 +6194,10 @@ function listActionCatalog() {
6192
6194
  ...meta
6193
6195
  }));
6194
6196
  }
6197
+ function isScopeable(action) {
6198
+ var _a, _b;
6199
+ return (_b = (_a = ActionCatalog[action]) == null ? void 0 : _a.scopeable) != null ? _b : false;
6200
+ }
6195
6201
 
6196
6202
  // src/model/rbac/Role.schema.ts
6197
6203
  var RoleSchema = external_exports.object({