shred-api-client 2.8.0 → 2.8.1

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
@@ -3517,7 +3517,8 @@ declare namespace index$1 {
3517
3517
  * An Action is an atomic capability the code checks (via `<Allowed>` in the hub,
3518
3518
  * `requireAction` in the API). Roles are bags of Actions; the code never checks roles.
3519
3519
  *
3520
- * Adding a capability = add a key here, then bump this package (see rbac docs).
3520
+ * Adding a capability = add a key here, add its metadata to `ActionCatalog`
3521
+ * (the compiler enforces the entry exists), then bump this package (see rbac docs).
3521
3522
  * String values are dot-notation `domain.action` and are permanent once shipped.
3522
3523
  */
3523
3524
  declare const Actions: {
@@ -3581,7 +3582,6 @@ declare const Actions: {
3581
3582
  readonly PROMPT_GET: "prompt.get";
3582
3583
  readonly EMAIL_SEND: "email.send";
3583
3584
  readonly USER_SEARCH: "user.search";
3584
- readonly USER_CREATE_PRIVILEGED: "user.create_privileged";
3585
3585
  readonly USER_UPDATE: "user.update";
3586
3586
  readonly USER_DELETE: "user.delete";
3587
3587
  readonly USER_CHANGE_EMAIL: "user.change_email";
@@ -3603,26 +3603,35 @@ type Scope = {
3603
3603
  id: string;
3604
3604
  };
3605
3605
  type ActionGroup = "Projects" | "Editors" | "Goals" | "Notes" | "Tenants" | "Offers" | "Subscriptions" | "Scripts" | "Prompts" | "Email" | "Users" | "Administration";
3606
- /** Metadata for one Action — powers the admin "create/edit role" UI (GET /actions). */
3607
- type ActionCatalogEntry = {
3608
- key: Action;
3606
+ type ActionMeta = {
3609
3607
  label: string;
3610
3608
  group: ActionGroup;
3611
3609
  };
3610
+ /** One catalog row as served to the admin UI (GET /actions). */
3611
+ type ActionCatalogEntry = ActionMeta & {
3612
+ key: Action;
3613
+ };
3612
3614
  /**
3613
- * Human-readable catalog for the admin UI. References `Actions.*` values so the
3614
- * string literal lives in exactly one place — this only adds label + group metadata.
3615
+ * Human-readable metadata for every Action, powering the admin "create/edit role" UI.
3616
+ *
3617
+ * Typed as `Record<Action, ActionMeta>`, so the compiler GUARANTEES: every Action has
3618
+ * exactly one entry (a missing one is a build error), and no entry can reference an
3619
+ * Action that doesn't exist. Keys reference `Actions.*` so each string lives in one place.
3615
3620
  */
3616
- declare const ActionCatalog: ActionCatalogEntry[];
3621
+ declare const ActionCatalog: Record<Action, ActionMeta>;
3622
+ /** The catalog as a flat list of `{ key, label, group }` — e.g. for `GET /actions`. */
3623
+ declare function listActionCatalog(): ActionCatalogEntry[];
3617
3624
 
3618
3625
  type index_Action = Action;
3619
3626
  declare const index_ActionCatalog: typeof ActionCatalog;
3620
3627
  type index_ActionCatalogEntry = ActionCatalogEntry;
3621
3628
  type index_ActionGroup = ActionGroup;
3629
+ type index_ActionMeta = ActionMeta;
3622
3630
  declare const index_Actions: typeof Actions;
3623
3631
  type index_Scope = Scope;
3632
+ declare const index_listActionCatalog: typeof listActionCatalog;
3624
3633
  declare namespace index {
3625
- export { type index_Action as Action, index_ActionCatalog as ActionCatalog, type index_ActionCatalogEntry as ActionCatalogEntry, type index_ActionGroup as ActionGroup, index_Actions as Actions, type index_Scope as Scope };
3634
+ export { type index_Action as Action, index_ActionCatalog as ActionCatalog, type index_ActionCatalogEntry as ActionCatalogEntry, type index_ActionGroup as ActionGroup, type index_ActionMeta as ActionMeta, index_Actions as Actions, type index_Scope as Scope, index_listActionCatalog as listActionCatalog };
3626
3635
  }
3627
3636
 
3628
3637
  export { index$1 as Asset, index$d as Core, index$6 as Editor, index$9 as Email, index$2 as Exceptions, index$7 as Goal, index$4 as Note, index$5 as Notification, index$8 as Project, index$f as Prompt, index as RBAC, ShredAPI, index$3 as SpecialOffer, index$e as Subscription, index$b as Tenant, index$a as Track, index$c as User, ShredAPI as default };
package/dist/index.js CHANGED
@@ -6476,7 +6476,8 @@ __export(special_offer_exports, {
6476
6476
  var rbac_exports = {};
6477
6477
  __export(rbac_exports, {
6478
6478
  ActionCatalog: () => ActionCatalog,
6479
- Actions: () => Actions
6479
+ Actions: () => Actions,
6480
+ listActionCatalog: () => listActionCatalog
6480
6481
  });
6481
6482
 
6482
6483
  // src/model/rbac/Actions.ts
@@ -6553,7 +6554,6 @@ var Actions = {
6553
6554
  EMAIL_SEND: "email.send",
6554
6555
  // — Users —
6555
6556
  USER_SEARCH: "user.search",
6556
- USER_CREATE_PRIVILEGED: "user.create_privileged",
6557
6557
  USER_UPDATE: "user.update",
6558
6558
  USER_DELETE: "user.delete",
6559
6559
  USER_CHANGE_EMAIL: "user.change_email",
@@ -6563,88 +6563,93 @@ var Actions = {
6563
6563
  ROLE_MANAGE: "role.manage",
6564
6564
  USER_ASSIGN_ROLE: "user.assign_role"
6565
6565
  };
6566
- var ActionCatalog = [
6566
+ var ActionCatalog = {
6567
6567
  // Projects
6568
- { key: Actions.PROJECT_APPROVE, label: "Approve project", group: "Projects" },
6569
- { key: Actions.PROJECT_DENY, label: "Deny project", group: "Projects" },
6570
- { key: Actions.PROJECT_ASSIGN, label: "Assign project", group: "Projects" },
6571
- { key: Actions.PROJECT_ROLLBACK, label: "Rollback project", group: "Projects" },
6572
- { key: Actions.PROJECT_SCHEDULE, label: "Schedule project", group: "Projects" },
6573
- { key: Actions.PROJECT_UNSCHEDULE, label: "Unschedule project", group: "Projects" },
6574
- { key: Actions.PROJECT_GET_NEXT_IN_QUEUE, label: "Get next project in queue", group: "Projects" },
6575
- { key: Actions.PROJECT_VIEW_ALL, label: "View all projects", group: "Projects" },
6576
- { key: Actions.PROJECT_VIEW_HISTORY, label: "View project history", group: "Projects" },
6577
- { key: Actions.PROJECT_START, label: "Start project (pull from pool)", group: "Projects" },
6578
- { key: Actions.PROJECT_SEND_TO_APPROVAL, label: "Send project to approval", group: "Projects" },
6579
- { key: Actions.PROJECT_VIEW_POOL, label: "View pool size", group: "Projects" },
6580
- { key: Actions.PROJECT_STREAM, label: "Stream projects (realtime)", group: "Projects" },
6581
- { key: Actions.PROJECT_CREATE, label: "Create project", group: "Projects" },
6582
- { key: Actions.PROJECT_CANCEL, label: "Cancel project", group: "Projects" },
6583
- { key: Actions.PROJECT_REORDER, label: "Reorder projects", group: "Projects" },
6584
- { key: Actions.PROJECT_REQUEST_REVIEW, label: "Request project review", group: "Projects" },
6585
- { key: Actions.PROJECT_RECORD_INTERACTION, label: "Record project interaction", group: "Projects" },
6586
- { key: Actions.PROJECT_CHECK_FREE_QUOTA, label: "Check free project quota", group: "Projects" },
6587
- { key: Actions.PROJECT_LIST_OWN, label: "List own projects", group: "Projects" },
6588
- { key: Actions.PROJECT_VIEW_OWN, label: "View own project", group: "Projects" },
6568
+ [Actions.PROJECT_APPROVE]: { label: "Approve project", group: "Projects" },
6569
+ [Actions.PROJECT_DENY]: { label: "Deny project", group: "Projects" },
6570
+ [Actions.PROJECT_ASSIGN]: { label: "Assign project", group: "Projects" },
6571
+ [Actions.PROJECT_ROLLBACK]: { label: "Rollback project", group: "Projects" },
6572
+ [Actions.PROJECT_SCHEDULE]: { label: "Schedule project", group: "Projects" },
6573
+ [Actions.PROJECT_UNSCHEDULE]: { label: "Unschedule project", group: "Projects" },
6574
+ [Actions.PROJECT_GET_NEXT_IN_QUEUE]: { label: "Get next project in queue", group: "Projects" },
6575
+ [Actions.PROJECT_VIEW_ALL]: { label: "View all projects", group: "Projects" },
6576
+ [Actions.PROJECT_VIEW_HISTORY]: { label: "View project history", group: "Projects" },
6577
+ [Actions.PROJECT_START]: { label: "Start project (pull from pool)", group: "Projects" },
6578
+ [Actions.PROJECT_SEND_TO_APPROVAL]: { label: "Send project to approval", group: "Projects" },
6579
+ [Actions.PROJECT_VIEW_POOL]: { label: "View pool size", group: "Projects" },
6580
+ [Actions.PROJECT_STREAM]: { label: "Stream projects (realtime)", group: "Projects" },
6581
+ [Actions.PROJECT_CREATE]: { label: "Create project", group: "Projects" },
6582
+ [Actions.PROJECT_CANCEL]: { label: "Cancel project", group: "Projects" },
6583
+ [Actions.PROJECT_REORDER]: { label: "Reorder projects", group: "Projects" },
6584
+ [Actions.PROJECT_REQUEST_REVIEW]: { label: "Request project review", group: "Projects" },
6585
+ [Actions.PROJECT_RECORD_INTERACTION]: { label: "Record project interaction", group: "Projects" },
6586
+ [Actions.PROJECT_CHECK_FREE_QUOTA]: { label: "Check free project quota", group: "Projects" },
6587
+ [Actions.PROJECT_LIST_OWN]: { label: "List own projects", group: "Projects" },
6588
+ [Actions.PROJECT_VIEW_OWN]: { label: "View own project", group: "Projects" },
6589
6589
  // Editors
6590
- { key: Actions.EDITOR_LIST, label: "List editors", group: "Editors" },
6591
- { key: Actions.EDITOR_GET, label: "View editor", group: "Editors" },
6590
+ [Actions.EDITOR_LIST]: { label: "List editors", group: "Editors" },
6591
+ [Actions.EDITOR_GET]: { label: "View editor", group: "Editors" },
6592
6592
  // Goals
6593
- { key: Actions.GOAL_VIEW_OWN, label: "View own goals", group: "Goals" },
6594
- { key: Actions.GOAL_VIEW_EDITOR, label: "View editor goals", group: "Goals" },
6593
+ [Actions.GOAL_VIEW_OWN]: { label: "View own goals", group: "Goals" },
6594
+ [Actions.GOAL_VIEW_EDITOR]: { label: "View editor goals", group: "Goals" },
6595
6595
  // Notes
6596
- { key: Actions.NOTE_VIEW, label: "View notes", group: "Notes" },
6597
- { key: Actions.NOTE_CREATE, label: "Create note", group: "Notes" },
6598
- { key: Actions.NOTE_UPDATE, label: "Update note", group: "Notes" },
6599
- { key: Actions.NOTE_DELETE, label: "Delete note", group: "Notes" },
6596
+ [Actions.NOTE_VIEW]: { label: "View notes", group: "Notes" },
6597
+ [Actions.NOTE_CREATE]: { label: "Create note", group: "Notes" },
6598
+ [Actions.NOTE_UPDATE]: { label: "Update note", group: "Notes" },
6599
+ [Actions.NOTE_DELETE]: { label: "Delete note", group: "Notes" },
6600
6600
  // Tenants
6601
- { key: Actions.TENANT_CREATE, label: "Create tenant", group: "Tenants" },
6602
- { key: Actions.TENANT_LIST, label: "List tenants", group: "Tenants" },
6603
- { key: Actions.TENANT_VIEW, label: "View tenant", group: "Tenants" },
6604
- { key: Actions.TENANT_UPDATE, label: "Update tenant", group: "Tenants" },
6605
- { key: Actions.TENANT_VIEW_MEMBERS, label: "View tenant members", group: "Tenants" },
6606
- { key: Actions.TENANT_UPDATE_MEMBERS, label: "Update tenant members", group: "Tenants" },
6607
- { key: Actions.TENANT_UPDATE_REPORT_VIEWERS, label: "Update tenant report viewers", group: "Tenants" },
6608
- { key: Actions.TENANT_VIEW_REPORT, label: "View tenant report", group: "Tenants" },
6609
- { key: Actions.TENANT_VIEW_MINE, label: "View my tenant", group: "Tenants" },
6601
+ [Actions.TENANT_CREATE]: { label: "Create tenant", group: "Tenants" },
6602
+ [Actions.TENANT_LIST]: { label: "List tenants", group: "Tenants" },
6603
+ [Actions.TENANT_VIEW]: { label: "View tenant", group: "Tenants" },
6604
+ [Actions.TENANT_UPDATE]: { label: "Update tenant", group: "Tenants" },
6605
+ [Actions.TENANT_VIEW_MEMBERS]: { label: "View tenant members", group: "Tenants" },
6606
+ [Actions.TENANT_UPDATE_MEMBERS]: { label: "Update tenant members", group: "Tenants" },
6607
+ [Actions.TENANT_UPDATE_REPORT_VIEWERS]: { label: "Update tenant report viewers", group: "Tenants" },
6608
+ [Actions.TENANT_VIEW_REPORT]: { label: "View tenant report", group: "Tenants" },
6609
+ [Actions.TENANT_VIEW_MINE]: { label: "View my tenant", group: "Tenants" },
6610
6610
  // Offers
6611
- { key: Actions.OFFER_LIST, label: "List offers", group: "Offers" },
6612
- { key: Actions.OFFER_CREATE, label: "Create offer", group: "Offers" },
6613
- { key: Actions.OFFER_UPDATE, label: "Update offer", group: "Offers" },
6614
- { key: Actions.OFFER_ENABLE, label: "Enable offer", group: "Offers" },
6615
- { key: Actions.OFFER_DISABLE, label: "Disable offer", group: "Offers" },
6616
- { key: Actions.OFFER_GET_MINE, label: "View my offer", group: "Offers" },
6617
- { key: Actions.OFFER_CLAIM, label: "Claim offer", group: "Offers" },
6611
+ [Actions.OFFER_LIST]: { label: "List offers", group: "Offers" },
6612
+ [Actions.OFFER_CREATE]: { label: "Create offer", group: "Offers" },
6613
+ [Actions.OFFER_UPDATE]: { label: "Update offer", group: "Offers" },
6614
+ [Actions.OFFER_ENABLE]: { label: "Enable offer", group: "Offers" },
6615
+ [Actions.OFFER_DISABLE]: { label: "Disable offer", group: "Offers" },
6616
+ [Actions.OFFER_GET_MINE]: { label: "View my offer", group: "Offers" },
6617
+ [Actions.OFFER_CLAIM]: { label: "Claim offer", group: "Offers" },
6618
6618
  // Subscriptions
6619
- { key: Actions.SUBSCRIPTION_VIEW_USER, label: "View user subscription", group: "Subscriptions" },
6620
- { key: Actions.SUBSCRIPTION_VIEW_SUMMARY, label: "View subscription summary", group: "Subscriptions" },
6621
- { key: Actions.SUBSCRIPTION_LIST_PROMO_CODES, label: "List promo codes", group: "Subscriptions" },
6622
- { key: Actions.SUBSCRIPTION_CHECKOUT, label: "Checkout subscription", group: "Subscriptions" },
6623
- { key: Actions.SUBSCRIPTION_PORTAL, label: "Open subscription portal", group: "Subscriptions" },
6624
- { key: Actions.SUBSCRIPTION_VIEW_ACTIVE, label: "View active subscription", group: "Subscriptions" },
6625
- { key: Actions.SUBSCRIPTION_LIST_PRODUCTS, label: "List subscription products", group: "Subscriptions" },
6619
+ [Actions.SUBSCRIPTION_VIEW_USER]: { label: "View user subscription", group: "Subscriptions" },
6620
+ [Actions.SUBSCRIPTION_VIEW_SUMMARY]: { label: "View subscription summary", group: "Subscriptions" },
6621
+ [Actions.SUBSCRIPTION_LIST_PROMO_CODES]: { label: "List promo codes", group: "Subscriptions" },
6622
+ [Actions.SUBSCRIPTION_CHECKOUT]: { label: "Checkout subscription", group: "Subscriptions" },
6623
+ [Actions.SUBSCRIPTION_PORTAL]: { label: "Open subscription portal", group: "Subscriptions" },
6624
+ [Actions.SUBSCRIPTION_VIEW_ACTIVE]: { label: "View active subscription", group: "Subscriptions" },
6625
+ [Actions.SUBSCRIPTION_LIST_PRODUCTS]: { label: "List subscription products", group: "Subscriptions" },
6626
6626
  // Scripts
6627
- { key: Actions.SCRIPT_LIST, label: "List scripts", group: "Scripts" },
6628
- { key: Actions.SCRIPT_CREATE, label: "Create script", group: "Scripts" },
6629
- { key: Actions.SCRIPT_UPDATE, label: "Update script", group: "Scripts" },
6630
- { key: Actions.SCRIPT_DELETE, label: "Delete script", group: "Scripts" },
6631
- { key: Actions.SCRIPT_GENERATE, label: "Generate script", group: "Scripts" },
6627
+ [Actions.SCRIPT_LIST]: { label: "List scripts", group: "Scripts" },
6628
+ [Actions.SCRIPT_CREATE]: { label: "Create script", group: "Scripts" },
6629
+ [Actions.SCRIPT_UPDATE]: { label: "Update script", group: "Scripts" },
6630
+ [Actions.SCRIPT_DELETE]: { label: "Delete script", group: "Scripts" },
6631
+ [Actions.SCRIPT_GENERATE]: { label: "Generate script", group: "Scripts" },
6632
6632
  // Prompts
6633
- { key: Actions.PROMPT_GET, label: "Get prompt", group: "Prompts" },
6633
+ [Actions.PROMPT_GET]: { label: "Get prompt", group: "Prompts" },
6634
6634
  // Email
6635
- { key: Actions.EMAIL_SEND, label: "Send email", group: "Email" },
6635
+ [Actions.EMAIL_SEND]: { label: "Send email", group: "Email" },
6636
6636
  // Users
6637
- { key: Actions.USER_SEARCH, label: "Search users", group: "Users" },
6638
- { key: Actions.USER_CREATE_PRIVILEGED, label: "Create privileged user", group: "Users" },
6639
- { key: Actions.USER_UPDATE, label: "Update own profile", group: "Users" },
6640
- { key: Actions.USER_DELETE, label: "Delete own account", group: "Users" },
6641
- { key: Actions.USER_CHANGE_EMAIL, label: "Change own email", group: "Users" },
6642
- { key: Actions.USER_GET_TOKEN, label: "Get API token", group: "Users" },
6643
- { key: Actions.USER_CREATE_TOKEN, label: "Create API token", group: "Users" },
6637
+ [Actions.USER_SEARCH]: { label: "Search users", group: "Users" },
6638
+ [Actions.USER_UPDATE]: { label: "Update own profile", group: "Users" },
6639
+ [Actions.USER_DELETE]: { label: "Delete own account", group: "Users" },
6640
+ [Actions.USER_CHANGE_EMAIL]: { label: "Change own email", group: "Users" },
6641
+ [Actions.USER_GET_TOKEN]: { label: "Get API token", group: "Users" },
6642
+ [Actions.USER_CREATE_TOKEN]: { label: "Create API token", group: "Users" },
6644
6643
  // Administration
6645
- { key: Actions.ROLE_MANAGE, label: "Manage roles", group: "Administration" },
6646
- { key: Actions.USER_ASSIGN_ROLE, label: "Assign roles to users", group: "Administration" }
6647
- ];
6644
+ [Actions.ROLE_MANAGE]: { label: "Manage roles", group: "Administration" },
6645
+ [Actions.USER_ASSIGN_ROLE]: { label: "Assign roles to users", group: "Administration" }
6646
+ };
6647
+ function listActionCatalog() {
6648
+ return Object.entries(ActionCatalog).map(([key, meta]) => ({
6649
+ key,
6650
+ ...meta
6651
+ }));
6652
+ }
6648
6653
 
6649
6654
  // src/index.ts
6650
6655
  var index_default = ShredAPI;