34 lines
821 B
TypeScript
34 lines
821 B
TypeScript
|
|
// ============================================================================
|
||
|
|
// Token Data Types
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
import type { TRegistryProtocol } from './package.ts';
|
||
|
|
|
||
|
|
export type TTokenAction = 'read' | 'write' | 'delete' | '*';
|
||
|
|
|
||
|
|
export interface ITokenScope {
|
||
|
|
protocol: TRegistryProtocol | '*';
|
||
|
|
organizationId?: string;
|
||
|
|
repositoryId?: string;
|
||
|
|
actions: TTokenAction[];
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface IToken {
|
||
|
|
id: string;
|
||
|
|
name: string;
|
||
|
|
tokenPrefix: string;
|
||
|
|
protocols: TRegistryProtocol[];
|
||
|
|
scopes: ITokenScope[];
|
||
|
|
organizationId?: string;
|
||
|
|
createdById?: string;
|
||
|
|
expiresAt?: string;
|
||
|
|
lastUsedAt?: string;
|
||
|
|
usageCount: number;
|
||
|
|
createdAt: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface ITokenCreateResult extends IToken {
|
||
|
|
token: string;
|
||
|
|
warning: string;
|
||
|
|
}
|