@foss.global/codefeed 5.0.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +39 -0
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.giteasourceinventory.d.ts +35 -9
- package/dist_ts/classes.giteasourceinventory.js +448 -45
- package/dist_ts/classes.giteasourcetransfer.d.ts +114 -6
- package/dist_ts/classes.giteasourcetransfer.js +326 -9
- package/dist_ts/forgeinventory.client.d.ts +22 -4
- package/dist_ts/forgeinventory.client.js +32 -13
- package/dist_ts/giteasourceinventory.packages.d.ts +46 -0
- package/dist_ts/giteasourceinventory.packages.js +139 -0
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +2 -1
- package/dist_ts/plugins.d.ts +2 -2
- package/dist_ts/plugins.js +3 -1
- package/package.json +3 -3
- package/readme.md +37 -3
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.giteasourceinventory.ts +465 -44
- package/ts/classes.giteasourcetransfer.ts +395 -8
- package/ts/forgeinventory.client.ts +63 -12
- package/ts/giteasourceinventory.packages.ts +160 -0
- package/ts/index.ts +1 -0
- package/ts/plugins.ts +2 -2
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as plugins from './plugins.js';
|
|
2
2
|
import type { ILfsRequestOptions, TLfsDownload } from './classes.lfsbatchclient.js';
|
|
3
|
+
type IPackageRecord = plugins.fossInterfaces.data.IForgeSourcePackageInventory;
|
|
4
|
+
type IPackageVersion = plugins.fossInterfaces.data.IForgeSourcePackageVersion;
|
|
5
|
+
type IPackageBlob = plugins.fossInterfaces.data.IForgeSourcePackageBlob;
|
|
3
6
|
export interface IGiteaSourceTransferOptions {
|
|
4
7
|
/** Instance root, including an optional deployment subpath. HTTPS is required. */
|
|
5
8
|
baseUrl: string;
|
|
@@ -23,6 +26,8 @@ export interface IGiteaSourceTransferOptions {
|
|
|
23
26
|
lfsTransferTimeoutMs?: number;
|
|
24
27
|
/** Wall-clock limit of one release asset download, its closing identity reads included; defaults to 30 minutes, at most six hours. */
|
|
25
28
|
releaseAssetTimeoutMs?: number;
|
|
29
|
+
/** Wall-clock limit of one package blob or file download, its closing identity read included; defaults to 30 minutes, at most six hours. */
|
|
30
|
+
packageTransferTimeoutMs?: number;
|
|
26
31
|
}
|
|
27
32
|
/**
|
|
28
33
|
* A source repository: its owner's and its own name, which Git and LFS reach
|
|
@@ -64,18 +69,71 @@ export interface IGiteaReleaseAssetDownload {
|
|
|
64
69
|
*/
|
|
65
70
|
stream: InstanceType<typeof plugins.stream.Readable>;
|
|
66
71
|
}
|
|
72
|
+
/** A package as the source inventory recorded it: what a read names, and the owner id it checks Gitea still holds. */
|
|
73
|
+
export type TGiteaPackageSelector = Pick<IPackageRecord, 'owner' | 'ownerId' | 'type' | 'name'>;
|
|
74
|
+
/** A version as the source inventory recorded it; its id identifies it, so a tag pushed again is another version. */
|
|
75
|
+
export type TGiteaPackageVersionSelector = Pick<IPackageVersion, 'id' | 'version'>;
|
|
76
|
+
/** Content as the source inventory recorded it: the SHA-256 and size of a blob. */
|
|
77
|
+
export type TGiteaPackageContentSelector = Pick<IPackageBlob, 'sha256' | 'size'>;
|
|
78
|
+
/** A file of a version as the source inventory recorded it: its name and the content it holds. */
|
|
79
|
+
export interface IGiteaPackageFileSelector extends TGiteaPackageContentSelector {
|
|
80
|
+
name: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Metadata a package version carries beside its files, read as Gitea serves
|
|
84
|
+
* it: an npm version document, Swift release metadata, a Swift release's
|
|
85
|
+
* `Package.swift`, or a crate version's line of the Cargo sparse index.
|
|
86
|
+
*/
|
|
87
|
+
export type TGiteaPackageDocumentKind = 'npm-version' | 'swift-release' | 'swift-manifest' | 'cargo-index-entry';
|
|
88
|
+
export interface IGiteaPackageReadOptions {
|
|
89
|
+
/** Aborts the read with `request-aborted`, also while a stream is read. */
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
}
|
|
92
|
+
/** A container manifest with the exact bytes and `Content-Type` Gitea serves. */
|
|
93
|
+
export interface IGiteaContainerManifest {
|
|
94
|
+
/** `sha256:` and the hex digest the bytes were checked against. */
|
|
95
|
+
digest: string;
|
|
96
|
+
/** The `Content-Type` header verbatim: the media type the manifest was pushed with. */
|
|
97
|
+
mediaType: string;
|
|
98
|
+
bytes: Buffer;
|
|
99
|
+
}
|
|
100
|
+
/** A version's metadata document with the exact bytes Gitea serves and their digest. */
|
|
101
|
+
export interface IGiteaPackageDocument {
|
|
102
|
+
kind: TGiteaPackageDocumentKind;
|
|
103
|
+
/** The id of the version the identity reads before and after the read confirmed. */
|
|
104
|
+
versionId: string;
|
|
105
|
+
/** For `cargo-index-entry`, the version's line of the sparse index without its newline. */
|
|
106
|
+
bytes: Buffer;
|
|
107
|
+
/** Lowercase hex SHA-256 of `bytes`. */
|
|
108
|
+
sha256: string;
|
|
109
|
+
/** The media type Gitea declared, without parameters. */
|
|
110
|
+
mediaType: string;
|
|
111
|
+
}
|
|
112
|
+
export interface IGiteaPackageDownload {
|
|
113
|
+
content: TGiteaPackageContentSelector;
|
|
114
|
+
/**
|
|
115
|
+
* The content's bytes, never held whole. The last chunk is held back until
|
|
116
|
+
* exactly `content.size` bytes have arrived, their SHA-256 equals
|
|
117
|
+
* `content.sha256` and, for a version's file, the closing identity read has
|
|
118
|
+
* passed. Destroying the stream ends the download.
|
|
119
|
+
*/
|
|
120
|
+
stream: InstanceType<typeof plugins.stream.Readable>;
|
|
121
|
+
}
|
|
67
122
|
export interface IGiteaMirrorImport {
|
|
68
123
|
repository: plugins.TGitManagerRepositoryInfo;
|
|
69
124
|
/** The repository size Gitea reported, in KiB, which sized the scratch reservation. */
|
|
70
125
|
reportedSizeKiB: string;
|
|
71
126
|
}
|
|
72
127
|
/**
|
|
73
|
-
* Reads a Gitea repository's Git data and LFS objects
|
|
74
|
-
* migration, with the reader's login and token: a mirror
|
|
75
|
-
* GitManager the caller supplies, verified LFS object downloads
|
|
76
|
-
* asset downloads
|
|
77
|
-
*
|
|
78
|
-
*
|
|
128
|
+
* Reads a Gitea repository's Git data and LFS objects, and package content,
|
|
129
|
+
* for its one-time migration, with the reader's login and token: a mirror
|
|
130
|
+
* clone into a GitManager the caller supplies, verified LFS object downloads,
|
|
131
|
+
* release asset downloads, container manifests and blobs, package files and
|
|
132
|
+
* package metadata documents. It never writes to Gitea: Git is read only
|
|
133
|
+
* through `git-upload-pack`, LFS only through batch `download` requests and
|
|
134
|
+
* their download actions, release assets only through GETs of their
|
|
135
|
+
* attachment, packages only through GETs of the registries and the v1 package
|
|
136
|
+
* API.
|
|
79
137
|
*/
|
|
80
138
|
export declare class GiteaSourceTransfer {
|
|
81
139
|
#private;
|
|
@@ -150,4 +208,54 @@ export declare class GiteaSourceTransfer {
|
|
|
150
208
|
* by the identity reads as for `downloadLfsObject`.
|
|
151
209
|
*/
|
|
152
210
|
downloadReleaseAsset(repositoryArg: IGiteaSourceRepository, releaseIdArg: string, assetArg: TGiteaReleaseAssetSelector, optionsArg?: IGiteaReleaseAssetDownloadOptions): Promise<IGiteaReleaseAssetDownload>;
|
|
211
|
+
/**
|
|
212
|
+
* Reads one container manifest by digest from the registry with the
|
|
213
|
+
* reader's Basic credentials: its exact bytes, which must hash to `digest`
|
|
214
|
+
* (`package-manifest-digest-mismatch`), and its `Content-Type` verbatim,
|
|
215
|
+
* which must be an OCI or Docker image manifest, index or manifest list
|
|
216
|
+
* (`package-manifest-media-type-invalid`). A manifest is content-addressed,
|
|
217
|
+
* so no identity read is needed. Reading it counts a download of the version
|
|
218
|
+
* holding it, an accepted read stamp (S10 ruling, item 8).
|
|
219
|
+
*/
|
|
220
|
+
readContainerManifest(packageArg: TGiteaPackageSelector, digestArg: string, optionsArg?: IGiteaPackageReadOptions): Promise<IGiteaContainerManifest>;
|
|
221
|
+
/**
|
|
222
|
+
* Downloads one container blob, a config or a layer, by digest from the
|
|
223
|
+
* registry with the reader's Basic credentials. The bytes stream verified:
|
|
224
|
+
* the last chunk is held back until exactly `content.size` bytes have
|
|
225
|
+
* arrived and their SHA-256 equals `content.sha256`. A blob is
|
|
226
|
+
* content-addressed, so no identity read is needed, and reading one counts
|
|
227
|
+
* no download. Rejects, or errors the stream, with a fixed code such as
|
|
228
|
+
* `http-<status>`, `package-content-size-mismatch` (a `content-length` that
|
|
229
|
+
* is not the size), `package-content-size-overrun`, `package-content-short-body`,
|
|
230
|
+
* `package-content-digest-mismatch` or `package-content-transfer-timed-out`.
|
|
231
|
+
*/
|
|
232
|
+
downloadContainerBlob(packageArg: TGiteaPackageSelector, contentArg: TGiteaPackageContentSelector, optionsArg?: IGiteaPackageReadOptions): Promise<IGiteaPackageDownload>;
|
|
233
|
+
/**
|
|
234
|
+
* Downloads one file of a package version: a generic file, an npm tarball
|
|
235
|
+
* (`{package}/-/{version}/{file}`), a Swift source archive or a crate, by the
|
|
236
|
+
* route of the package's type with the reader's `token` authorization;
|
|
237
|
+
* container content is read with `readContainerManifest` and
|
|
238
|
+
* `downloadContainerBlob` (`package-type-unsupported`). The version is read
|
|
239
|
+
* by its id before the download and again after the last byte: it must
|
|
240
|
+
* still be the recorded version of the recorded owner, else
|
|
241
|
+
* `package-version-identity-changed`, or `http-404` once deleted. The bytes
|
|
242
|
+
* stream verified as for `downloadContainerBlob`. Reading a file counts a
|
|
243
|
+
* download of its version, an accepted read stamp (S10 ruling, item 8).
|
|
244
|
+
*/
|
|
245
|
+
downloadPackageFile(packageArg: TGiteaPackageSelector, versionArg: TGiteaPackageVersionSelector, fileArg: IGiteaPackageFileSelector, optionsArg?: IGiteaPackageReadOptions): Promise<IGiteaPackageDownload>;
|
|
246
|
+
/**
|
|
247
|
+
* Reads one metadata document of a package version with the reader's
|
|
248
|
+
* `token` authorization, bracketed by identity reads of the version as for
|
|
249
|
+
* `downloadPackageFile`: `npm-version` (the version document of an npm
|
|
250
|
+
* package), `swift-release` (Swift release metadata), `swift-manifest` (the
|
|
251
|
+
* release's `Package.swift`) or `cargo-index-entry` (the version's line of
|
|
252
|
+
* the crate's sparse index). The bytes are returned as Gitea serves them,
|
|
253
|
+
* with their SHA-256, which a consumer records beside the version id. None
|
|
254
|
+
* of these reads counts a download. A kind that does not belong to the
|
|
255
|
+
* package's type rejects with `package-document-kind-invalid`, a document
|
|
256
|
+
* of another media type with `invalid-content-type`, and a crate version
|
|
257
|
+
* missing from the index with `package-document-missing`.
|
|
258
|
+
*/
|
|
259
|
+
readPackageDocument(packageArg: TGiteaPackageSelector, versionArg: TGiteaPackageVersionSelector, kindArg: TGiteaPackageDocumentKind, optionsArg?: IGiteaPackageReadOptions): Promise<IGiteaPackageDocument>;
|
|
153
260
|
}
|
|
261
|
+
export {};
|