Skip to main content

Class: ScopeManager

Defined in: packages/sdk/src/scopes.ts:601

Manager for scope operations and validations

Constructors

Constructor

new ScopeManager(): ScopeManager

Returns

ScopeManager

Methods

expandScopes()

static expandScopes(scopeNames): Set<string>

Defined in: packages/sdk/src/scopes.ts:628

Expand a list of scope names to include all implied scopes

Parameters

scopeNames

string[]

Returns

Set<string>


formatScopeDescription()

static formatScopeDescription(scopeNames): Record<ScopeCategory, object[]>

Defined in: packages/sdk/src/scopes.ts:674

Format scope descriptions grouped by category

Parameters

scopeNames

string[]

Returns

Record<ScopeCategory, object[]>


formatScopeString()

static formatScopeString(scopes): string

Defined in: packages/sdk/src/scopes.ts:735

Convert scope array to space-separated string

Parameters

scopes

string[]

Returns

string


getAllScopes()

static getAllScopes(): Record<ScopeName, ScopeDefinition>

Defined in: packages/sdk/src/scopes.ts:612

Get all available scopes

Returns

Record<ScopeName, ScopeDefinition>


getDangerousScopes()

static getDangerousScopes(scopeNames): ScopeDefinition[]

Defined in: packages/sdk/src/scopes.ts:664

Get all dangerous scopes from a list of scope names

Parameters

scopeNames

string[]

Returns

ScopeDefinition[]


getScope()

static getScope(name): ScopeDefinition

Defined in: packages/sdk/src/scopes.ts:605

Get a scope by name

Parameters

name

"workspace:read" | "workspace:write" | "workspace:admin" | "members:read" | "members:write" | "members:admin" | "member_roles:read" | "member_roles:write" | "member_roles:admin" | "chats:read" | "chats:write" | "chats:admin" | "dm:read" | "dm:write" | "dm:admin" | "journeys:read" | "journeys:write" | "journeys:admin" | "experiments:read" | "experiments:write" | "experiments:admin" | "workflows:read" | "workflows:write" | "workflows:admin" | "assignments:read" | "assignments:write" | "assignments:admin" | "automations:read" | "automations:write" | "automations:admin" | "datatypes:read" | "datatypes:write" | "datatypes:admin" | "records:read" | "records:write" | "records:admin" | "files:read" | "files:write" | "files:admin" | "sites:read" | "sites:write" | "sites:admin" | "agents:read" | "agents:write" | "agents:admin" | "calendars:read" | "calendars:write" | "calendars:admin" | "inboxes:read" | "inboxes:write" | "inboxes:admin" | "phones:read" | "phones:write" | "phones:admin" | "webhooks:read" | "webhooks:write" | "webhooks:admin" | "webhooks:raw" | "apps:read" | "apps:write" | "apps:admin" | "labels:read" | "labels:write" | "analytics:read" | "operator:read" | "operator:write" | "org:info" | "org:read" | "org:write" | "org:admin" | "org:delete" | "export:read" | "export:write" | "export:admin" | "org:manage_admins"

Returns

ScopeDefinition


getScopesByCategory()

static getScopesByCategory(category): ScopeDefinition[]

Defined in: packages/sdk/src/scopes.ts:619

Get all scopes in a specific category

Parameters

category

ScopeCategory

Returns

ScopeDefinition[]


parseScopeString()

static parseScopeString(scopeString): string[]

Defined in: packages/sdk/src/scopes.ts:728

Parse a space-separated scope string into an array

Parameters

scopeString

string

Returns

string[]


validateScopes()

static validateScopes(scopeNames): string[]

Defined in: packages/sdk/src/scopes.ts:653

Validate that all scope names are valid

Parameters

scopeNames

string[]

Returns

string[]

List of invalid scope names, or empty array if all valid

Throws

Error if any scope names are invalid