-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.d.ts
65 lines (63 loc) · 2.35 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import { type Request } from 'express';
import { type Buffer } from 'node:buffer';
declare global {
type OciName = string; // [a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(\/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*
type OciAlgorithmComponent = string; // [a-z0-9]+
type OciEncoded = string; // [a-zA-Z0-9=_-]+
type OciAlgorithmSeparator = '+' | '.' | '_' | '-';
type OciOptionalAlgorithmComponent = `${OciAlgorithmSeparator}${OciAlgorithmComponent}` | ''; // FIXME:
type OciAlgorithm = `${OciAlgorithmComponent}${OciOptionalAlgorithmComponent}`;
type OciDigest = `${OciAlgorithm}:${OciEncoded}`;
type OciTag = string; // [a-zA-Z0-9_][a-zA-Z0-9._-]{0,127}
type OciReference = OciDigest | OciTag;
type OciMediaType = string;
// application/vnd.oci.descriptor.v1+json
type OciDescriptorV1 = {
mediaType: OciMediaType;
digest: OciDigest;
size: number;
urls?: string[];
annotations?: Record<string, string>;
artifactType?: OciMediaType;
};
type OciImageManifest = {
schemaVersion: 2;
mediaType: OciMediaType;
config: OciDescriptorV1;
layers: OciDescriptorV1[];
annotations?: Record<string, string>;
subject?: OciDescriptorV1;
artifactType?: OciMediaType;
};
type OciRangeIndex = number;
type OciRange = `${OciRangeIndex}-${OciRangeIndex}`; // ^[0-9]+-[0-9]+$
type OciErrorCode =
| 'BLOB_UNKNOWN'
| 'BLOB_UPLOAD_INVALID'
| 'BLOB_UPLOAD_UNKNOWN'
| 'DIGEST_INVALID'
| 'MANIFEST_BLOB_UNKNOWN'
| 'MANIFEST_INVALID'
| 'MANIFEST_UNKNOWN'
| 'NAME_INVALID'
| 'NAME_UNKNOWN'
| 'SIZE_INVALID'
| 'UNAUTHORIZED'
| 'DENIED'
| 'UNSUPPORTED'
| 'TOOMANYREQUESTS';
}
declare global {
type DigestRequest = Request<{ name: OciName; digest: OciDigest }>;
type ReferenceRequest = Request<{ name: OciName; reference: OciReference }>;
type DigestSearchRequest = Request<{ name: OciName }, unknown, Buffer, { digest?: OciDigest }>;
type ReferenceDigestSearchRequest = Request<
{ name: OciName; reference: OciReference },
unknown,
Buffer,
{ digest: OciDigest }
>;
type PaginatedPlainRequest = Request<{ name: OciName }, unknown, Buffer, { n?: number; last?: OciTag }>;
type MountRequest = Request<{ name: OciName }, unknown, Buffer, { mount?: OciDigest; from?: OciName }>;
type DigestArtifactRequest = Request<{ name: OciName; digest: OciDigest }, { artifactType: string }>;
}