Skip to content

feat: implement HTTP request handling with JSON and buffer support#29

Closed
piquark6046 wants to merge 1 commit intomainfrom
upd/20260405
Closed

feat: implement HTTP request handling with JSON and buffer support#29
piquark6046 wants to merge 1 commit intomainfrom
upd/20260405

Conversation

@piquark6046
Copy link
Copy Markdown
Member

  • 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.

- 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()) {
@piquark6046 piquark6046 closed this Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants