mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-30 11:31:02 +00:00
Merged via squash.
Prepared head SHA: 68e5f2ce19
Co-authored-by: 100yenadmin <239388517+100yenadmin@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
32 lines
973 B
TypeScript
32 lines
973 B
TypeScript
export const ADMIN_SCOPE = "operator.admin" as const;
|
|
export const READ_SCOPE = "operator.read" as const;
|
|
export const WRITE_SCOPE = "operator.write" as const;
|
|
export const APPROVALS_SCOPE = "operator.approvals" as const;
|
|
export const PAIRING_SCOPE = "operator.pairing" as const;
|
|
export const TALK_SECRETS_SCOPE = "operator.talk.secrets" as const;
|
|
|
|
export type OperatorScope =
|
|
| typeof ADMIN_SCOPE
|
|
| typeof READ_SCOPE
|
|
| typeof WRITE_SCOPE
|
|
| typeof APPROVALS_SCOPE
|
|
| typeof PAIRING_SCOPE
|
|
| typeof TALK_SECRETS_SCOPE;
|
|
|
|
const KNOWN_OPERATOR_SCOPE_VALUES: readonly OperatorScope[] = [
|
|
ADMIN_SCOPE,
|
|
READ_SCOPE,
|
|
WRITE_SCOPE,
|
|
APPROVALS_SCOPE,
|
|
PAIRING_SCOPE,
|
|
TALK_SECRETS_SCOPE,
|
|
];
|
|
|
|
export const KNOWN_OPERATOR_SCOPES: ReadonlySet<OperatorScope> = new Set(
|
|
KNOWN_OPERATOR_SCOPE_VALUES,
|
|
);
|
|
|
|
export function isOperatorScope(value: unknown): value is OperatorScope {
|
|
return typeof value === "string" && KNOWN_OPERATOR_SCOPES.has(value as OperatorScope);
|
|
}
|