112 lines
2.6 KiB
TypeScript
112 lines
2.6 KiB
TypeScript
/**
|
|
* Composer Registry Type Definitions
|
|
* Compliant with Composer v2 repository API
|
|
*/
|
|
|
|
/**
|
|
* Composer package metadata
|
|
*/
|
|
export interface IComposerPackage {
|
|
name: string; // vendor/package-name
|
|
version: string; // 1.0.0
|
|
version_normalized: string; // 1.0.0.0
|
|
type?: string; // library, project, metapackage
|
|
description?: string;
|
|
keywords?: string[];
|
|
homepage?: string;
|
|
license?: string[];
|
|
authors?: IComposerAuthor[];
|
|
require?: Record<string, string>;
|
|
'require-dev'?: Record<string, string>;
|
|
suggest?: Record<string, string>;
|
|
provide?: Record<string, string>;
|
|
conflict?: Record<string, string>;
|
|
replace?: Record<string, string>;
|
|
autoload?: IComposerAutoload;
|
|
'autoload-dev'?: IComposerAutoload;
|
|
dist?: IComposerDist;
|
|
source?: IComposerSource;
|
|
time?: string; // ISO 8601 timestamp
|
|
support?: Record<string, string>;
|
|
funding?: IComposerFunding[];
|
|
extra?: Record<string, any>;
|
|
}
|
|
|
|
/**
|
|
* Author information
|
|
*/
|
|
export interface IComposerAuthor {
|
|
name: string;
|
|
email?: string;
|
|
homepage?: string;
|
|
role?: string;
|
|
}
|
|
|
|
/**
|
|
* PSR-4/PSR-0 autoloading configuration
|
|
*/
|
|
export interface IComposerAutoload {
|
|
'psr-4'?: Record<string, string | string[]>;
|
|
'psr-0'?: Record<string, string | string[]>;
|
|
classmap?: string[];
|
|
files?: string[];
|
|
'exclude-from-classmap'?: string[];
|
|
}
|
|
|
|
/**
|
|
* Distribution information (ZIP download)
|
|
*/
|
|
export interface IComposerDist {
|
|
type: 'zip' | 'tar' | 'phar';
|
|
url: string;
|
|
reference?: string; // commit hash or tag
|
|
shasum?: string; // SHA-1 hash
|
|
}
|
|
|
|
/**
|
|
* Source repository information
|
|
*/
|
|
export interface IComposerSource {
|
|
type: 'git' | 'svn' | 'hg';
|
|
url: string;
|
|
reference: string; // commit hash, branch, or tag
|
|
}
|
|
|
|
/**
|
|
* Funding information
|
|
*/
|
|
export interface IComposerFunding {
|
|
type: string; // github, patreon, etc.
|
|
url: string;
|
|
}
|
|
|
|
/**
|
|
* Repository metadata (packages.json)
|
|
*/
|
|
export interface IComposerRepository {
|
|
packages?: Record<string, Record<string, IComposerPackage>>;
|
|
'metadata-url'?: string; // /p2/%package%.json
|
|
'available-packages'?: string[];
|
|
'available-package-patterns'?: string[];
|
|
'providers-url'?: string;
|
|
'notify-batch'?: string;
|
|
minified?: string; // "composer/2.0"
|
|
}
|
|
|
|
/**
|
|
* Package metadata response (/p2/vendor/package.json)
|
|
*/
|
|
export interface IComposerPackageMetadata {
|
|
packages: Record<string, IComposerPackage[]>;
|
|
minified?: string;
|
|
lastModified?: string;
|
|
}
|
|
|
|
/**
|
|
* Error structure
|
|
*/
|
|
export interface IComposerError {
|
|
status: string;
|
|
message: string;
|
|
}
|