FabricFabricSDK

Permissions

The four permission modes and the approval workflow.

Every operation has a risk level (read / write / destructive) and irreversible flag declared in endpointMeta. Plugins can opt into one of four permission modes:

ModeReadWriteDestructive
openallowallowallow
cautious (default)allowallowrequire approval
strictallowrequire approvalrequire approval
readonlyallowblockblock

Approvals workflow

When an operation requires approval, the runtime:

  1. Generates a permission record (pending) in the PermissionStore
  2. Returns a PermissionBlockedError to the caller with an approval token
  3. Waits for the token to be resolved (approved or denied)
  4. If approved, replays the operation; if denied, raises a denial error
const fabric = createFabric({
  plugins: [
    stripe({
      apiKey: '...',
      permissions: { mode: 'strict' },
    }),
  ],
});

try {
  await fabric.stripe.api.customers.delete({ id: 'cus_X' });
} catch (err) {
  if (err.name === 'PermissionBlockedError') {
    // err.token is the approval handle
  }
}

Approving from Studio

Fabric Studio's Approvals tab shows pending / completed / expired records with one-click approve and deny actions. See Studio docs.