feat: implement HTTP request handling with JSON and buffer support#29
Closed
piquark6046 wants to merge 1 commit intomainfrom
Closed
feat: implement HTTP request handling with JSON and buffer support#29piquark6046 wants to merge 1 commit intomainfrom
piquark6046 wants to merge 1 commit intomainfrom
Conversation
- Add http.ts for handling HTTP requests with SimpleSecureReq. - Implement functions for creating default headers, request options, and ensuring success status codes. - Add RequestExpectedAs, RequestJSON, and RequestBuffer functions for making requests and parsing responses. refactor: update npm API to use new HTTP request handling - Replace Got with RequestJSON in npm-api.ts for fetching package metadata. - Define Zod schemas for package metadata and version metadata. - Implement utility functions for encoding package names and creating registry URLs. refactor: enhance requests handling with structured responses - Update requests.ts to use RequestJSON for CDN status and purge requests. - Implement polling for purge request completion and concurrency handling. - Refactor PurgeRequestManager to manage batch requests and status polling. feat: add ZIP archive reading capabilities - Introduce zip.ts for reading text from ZIP archives. - Implement functions for extracting central directory entries and reading text from ZIP files. test: add tests for history manager and npm package metadata requests - Create echo server for simulating HTTP responses in tests. - Implement tests for HistoryManager to validate artifact downloads and parsing. - Add tests for RequestNpmPackageMetaData and FileManager to ensure correct behavior with local registry fixtures. test: add requests manager tests for batching and polling - Implement tests for PurgeRequestManager to validate request batching and polling behavior. chore: update TypeScript configuration - Change target from ES2022 to ES2024 and include test files in tsconfig.json.
| Actions.info('Running on ' + CPUModel + ' with ' + Os.availableParallelism() + ' threads/vCPUs.') | ||
|
|
||
| const CurrentTags = (await RequestNpmPackageMetaData(Options.Package))['dist-tags'] | ||
| await Fs.writeFile('/tmp/dist-tag.json', JSON.stringify(CurrentTags)) |
| const TarballPath = Path.join(this.WorkPath, this.Repo + '-' + Version + '.tgz') | ||
| const ExtractPath = Path.join(this.WorkPath, this.Repo + '-' + Version) | ||
|
|
||
| await FsPromises.mkdir(this.WorkPath, { recursive: true }) |
| const ExtractPath = Path.join(this.WorkPath, this.Repo + '-' + Version) | ||
|
|
||
| await FsPromises.mkdir(this.WorkPath, { recursive: true }) | ||
| await FsPromises.writeFile(TarballPath, TarballBuffer) |
|
|
||
| await FsPromises.mkdir(this.WorkPath, { recursive: true }) | ||
| await FsPromises.writeFile(TarballPath, TarballBuffer) | ||
| await FsPromises.mkdir(ExtractPath, { recursive: true }) |
| await FsPromises.writeFile(TarballPath, TarballBuffer) | ||
| await FsPromises.mkdir(ExtractPath, { recursive: true }) | ||
| await Tar.extract({ file: TarballPath, cwd: ExtractPath }) | ||
| await FsPromises.rm(TarballPath) |
| Files.push(`${SourcePath}/${Current}`) | ||
| const CurrentPath = Path.join(SourcePath, Current) | ||
|
|
||
| if (Fs.statSync(CurrentPath).isDirectory()) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
refactor: update npm API to use new HTTP request handling
refactor: enhance requests handling with structured responses
feat: add ZIP archive reading capabilities
test: add tests for history manager and npm package metadata requests
test: add requests manager tests for batching and polling
chore: update TypeScript configuration