{"id":49221929,"url":"https://github.com/neuxdotdev/apigsreport","last_synced_at":"2026-04-24T04:05:52.879Z","repository":{"id":350630754,"uuid":"1207662088","full_name":"neuxdotdev/apigsreport","owner":"neuxdotdev","description":"A Pure Http Client To Implementation Api Igs Report","archived":false,"fork":false,"pushed_at":"2026-04-11T08:43:42.000Z","size":95,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-04-11T10:17:35.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neuxdotdev.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license","code_of_conduct":"code_of_conduct.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-11T08:20:10.000Z","updated_at":"2026-04-11T08:43:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/neuxdotdev/apigsreport","commit_stats":null,"previous_names":["neuxdotdev/apigsreport"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/neuxdotdev/apigsreport","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuxdotdev%2Fapigsreport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuxdotdev%2Fapigsreport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuxdotdev%2Fapigsreport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuxdotdev%2Fapigsreport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neuxdotdev","download_url":"https://codeload.github.com/neuxdotdev/apigsreport/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neuxdotdev%2Fapigsreport/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32208498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T03:15:14.334Z","status":"ssl_error","status_checked_at":"2026-04-24T03:15:11.608Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-04-24T04:05:35.958Z","updated_at":"2026-04-24T04:05:52.870Z","avatar_url":"https://github.com/neuxdotdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# apigsreport\n\n\u003e **Pure TypeScript library for SSRS (SQL Server Reporting Services) API automation with NTLM authentication — reliable, fully typed, and encryption‑aware.**\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/apigsreport\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/apigsreport.svg?style=flat-square\u0026logo=npm\" alt=\"npm version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/apigsreport\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/apigsreport?style=flat-square\u0026logo=npm\" alt=\"npm downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/neuxdotdev/apigsreport/blob/main/license\"\u003e\u003cimg src=\"https://img.shields.io/github/license/neuxdotdev/apigsreport?style=flat-square\" alt=\"license\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/neuxdotdev/apigsreport/actions\"\u003e\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/neuxdotdev/apigsreport/build.yml?branch=main\u0026style=flat-square\u0026logo=github\" alt=\"build\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.typescriptlang.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/TypeScript-6.0-blue?style=flat-square\u0026logo=typescript\" alt=\"TypeScript\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://bun.sh\"\u003e\u003cimg src=\"https://img.shields.io/badge/Bun-1.3+-black?style=flat-square\u0026logo=bun\" alt=\"Bun\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://nodejs.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/Node-%3E%3D24-green?style=flat-square\u0026logo=node.js\" alt=\"Node\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://prettier.io\"\u003e\u003cimg src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\u0026logo=prettier\" alt=\"code style\"\u003e\u003c/a\u003e\n  \u003ca href=\"http://makeapullrequest.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square\" alt=\"PRs welcome\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n## Table of Contents\n\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Library API](#library-api)\n    - [`ApigsReportClient`](#apigsreportclient)\n    - [`renderReport` \u0026 `testAuth`](#renderreport--testauth)\n    - [`SsrsApiClient`](#ssrsapiclient)\n    - [`ConfigManager` \u0026 `EnvManager`](#configmanager--envmanager)\n    - [`Logger`](#logger)\n- [Error Handling](#error-handling)\n- [Configuration](#configuration)\n    - [Environment Variables](#environment-variables)\n    - [Encrypted Config File](#encrypted-config-file)\n- [Logging \u0026 Debugging](#logging--debugging)\n- [Development](#development)\n    - [Project Structure](#project-structure)\n    - [Scripts](#scripts)\n- [Contributing](#contributing)\n- [License](#license)\n\n---\n\n## Installation\n\n```bash\n# Using Bun (recommended)\nbun add apigsreport\n\n# Using npm\nnpm install apigsreport\n```\n\n**Prerequisites:** Node.js \u003e=24 or Bun \u003e=1.3.\n\n---\n\n## Quick Start\n\n### Simple report export\n\n```typescript\nimport { ApigsReportClient } from 'apigsreport'\n\nconst client = new ApigsReportClient({\n\tbaseUrl: 'https://reportserver.company.com',\n\tusername: 'DOMAIN\\\\john.doe',\n\tpassword: 'secure123',\n})\n\n// Export a PDF report (default report path is /IGS/WV_Kartu_Piutang_Wabot)\nconst pdfBuffer = await client.exportReport({\n\tformat: 'PDF',\n\tparameters: { AccountId: '12345' },\n})\n\n// Save to file\nawait client.exportReport({\n\tformat: 'EXCELOPENXML',\n\toutputPath: './report.xlsx',\n})\n```\n\n### Using low‑level API with custom report path\n\n```typescript\nimport { renderReport, testAuth } from 'apigsreport'\n\nconst credentials = {\n\tbaseUrl: 'https://reportserver.company.com',\n\tusername: 'DOMAIN\\\\john.doe',\n\tpassword: 'secure123',\n}\n\n// Test authentication\nconst auth = await testAuth(credentials)\nconsole.log(auth.success ? 'OK' : 'Failed')\n\n// Render any report\nconst response = await renderReport(credentials, {\n\treportPath: '/Sales/YearlySummary',\n\tformat: 'PDF',\n\tparameters: { Year: 2025 },\n})\n\nconsole.log(`Got ${response.body.length} bytes, status ${response.statusCode}`)\n```\n\n---\n\n## Library API\n\nThe library exports both a high‑level client and lower‑level functions.\n\n### `ApigsReportClient`\n\nMain client that bundles configuration validation, authentication, and report export.\n\n```typescript\nclass ApigsReportClient {\n\tconstructor(config: ApigsReportConfig)\n\texportReport(options?: ExportReportOptions): Promise\u003cBuffer\u003e\n\ttestAuth(): Promise\u003c{ success: boolean; message: string }\u003e\n\tdestroy(): void\n}\n```\n\n**`ApigsReportConfig`**:\n\n| Field           | Type     | Default     | Description                          |\n| --------------- | -------- | ----------- | ------------------------------------ |\n| `baseUrl`       | `string` | required    | SSRS server root URL                 |\n| `username`      | `string` | required    | NTLM username (can include domain)   |\n| `password`      | `string` | required    | NTLM password                        |\n| `domain`        | `string` | `undefined` | Optional domain (overrides username) |\n| `timeout`       | `number` | `30000`     | Request timeout (ms)                 |\n| `retryAttempts` | `number` | `3`         | Number of retries on network errors  |\n| `logLevel`      | `string` | `'info'`    | One of `'silent'`, `'error'`, …      |\n\n**`ExportReportOptions`**:\n\n| Field        | Type                                                     | Default | Description                   |\n| ------------ | -------------------------------------------------------- | ------- | ----------------------------- |\n| `format`     | `'PDF' \\| 'EXCELOPENXML' \\| 'CSV' \\| 'XML' \\| 'HTML4.0'` | `'PDF'` | Output format                 |\n| `parameters` | `Record\u003cstring, string \\| number \\| boolean\u003e`            | `{}`    | Report parameters             |\n| `outputPath` | `string`                                                 | –       | If given, writes file to disk |\n\n\u003e **Note:** The default report path is hardcoded to `/IGS/WV_Kartu_Piutang_Wabot`. For other reports use the low‑level `renderReport` function.\n\n### `renderReport` \u0026 `testAuth`\n\nStandalone functions for one‑off requests.\n\n```typescript\nfunction renderReport(credentials: NtlmCredentials, options: RenderOptions): Promise\u003cSsrsResponse\u003e\n\nfunction testAuth(credentials: NtlmCredentials): Promise\u003c{ success: boolean; message: string }\u003e\n```\n\n**`NtlmCredentials`**:\n\n```typescript\ninterface NtlmCredentials {\n\tbaseUrl: string\n\tusername: string\n\tpassword: string\n\tdomain?: string\n\tworkstation?: string\n}\n```\n\n**`RenderOptions`**:\n\n```typescript\ninterface RenderOptions {\n\treportPath: string\n\tformat: ReportFormat\n\tparameters?: Record\u003cstring, string | number | boolean\u003e\n\ttimeout?: number\n}\n```\n\n**`SsrsResponse`**:\n\n```typescript\ninterface SsrsResponse\u003cT = Buffer\u003e {\n\tstatusCode: number\n\theaders: Record\u003cstring, string | string[]\u003e\n\tbody: T\n\tduration: number\n\turl: string\n}\n```\n\n### `SsrsApiClient`\n\nLow‑level HTTP client for SSRS that handles NTLM authentication, URL building, and error classification.\n\n```typescript\nclass SsrsApiClient {\n\tconstructor(credentials: NtlmCredentials, timeout?: number)\n\trenderReport(options: RenderOptions): Promise\u003cSsrsResponse\u003e\n\ttestAuth(): Promise\u003c{ success: boolean; message: string }\u003e\n}\n```\n\n### `ConfigManager` \u0026 `EnvManager`\n\nHelpers for loading configuration from environment variables or an encrypted `.apigsreportrc` file.\n\n```typescript\nimport { configManager, envManager } from 'apigsreport'\n\n// Load from environment (development fallback)\nconst envConfig = envManager.load()\n\n// Load from encrypted file (production)\nconst fileConfig = await configManager.getWithFallback()\n\n// Save encrypted config\nawait configManager.save({\n\tSSRS_BASE_URL: 'https://...',\n\tSSRS_USERNAME: 'user',\n\tSSRS_PASSWORD: 'secret',\n\t// ...\n})\n```\n\n### `Logger`\n\nBuilt‑in logger with levels, timers, and structured output.\n\n```typescript\nimport { logger } from 'apigsreport'\n\nlogger.info('Export started', { report: '/Sales' })\nconst end = logger.time('export')\n// ... perform work\nend() // logs duration\n```\n\n---\n\n## Error Handling\n\nAll errors thrown by the library extend `ApigsError` and include:\n\n- `timestamp` – ISO string\n- `context` – additional debugging info\n- `toJSON()` – serializable for logs\n\n```typescript\nimport { isApigsError, AuthError, NetworkError } from 'apigsreport'\n\ntry {\n\tawait client.exportReport()\n} catch (err) {\n\tif (err instanceof AuthError) {\n\t\tconsole.error('Authentication failed:', err.errorCode)\n\t} else if (err instanceof NetworkError) {\n\t\tconsole.error(`HTTP ${err.statusCode} on ${err.url}`)\n\t} else if (isApigsError(err)) {\n\t\tconsole.error(err.toJSON())\n\t}\n}\n```\n\n**Error types**:\n\n| Class             | Code               | When                                                     |\n| ----------------- | ------------------ | -------------------------------------------------------- |\n| `ValidationError` | `VALIDATION_ERROR` | Invalid constructor arguments or missing fields          |\n| `ConfigError`     | `CONFIG_ERROR`     | Missing / corrupted config file or environment variables |\n| `AuthError`       | `AUTH_*`           | NTLM failure, invalid credentials, 401 response          |\n| `NetworkError`    | `NETWORK_ERROR`    | Timeout, ECONNREFUSED, 404, 5xx, etc.                    |\n| `CryptoError`     | `CRYPTO_ERROR`     | Master key or encryption/decryption failure              |\n| `ExportError`     | `EXPORT_ERROR`     | File write errors, output path validation                |\n\n---\n\n## Configuration\n\n### Environment Variables\n\nSet these variables for quick development or when no config file exists:\n\n| Variable          | Required | Description                       |\n| ----------------- | -------- | --------------------------------- |\n| `SSRS_BASE_URL`   | ✅       | e.g. `https://reportserver`       |\n| `SSRS_USERNAME`   | ✅       | NTLM username (`DOMAIN\\user`)     |\n| `SSRS_PASSWORD`   | ✅       | NTLM password                     |\n| `SSRS_DOMAIN`     | ❌       | Domain (optional, overrides)      |\n| `REQUEST_TIMEOUT` | ❌       | milliseconds, default `30000`     |\n| `RETRY_ATTEMPTS`  | ❌       | default `3`                       |\n| `LOG_LEVEL`       | ❌       | default `'info'`                  |\n| `NODE_ENV`        | ❌       | `'production'` forces config file |\n\n### Encrypted Config File\n\nIn production, the library expects an encrypted JSON file at `~/.apigsreportrc`.  \nThe file is encrypted using AES‑256‑GCM with a master key stored at `~/.config/apigsreport/.master_key`.\n\n**Creating the config file programmatically:**\n\n```typescript\nimport { configManager } from 'apigsreport'\n\nawait configManager.save({\n\tSSRS_BASE_URL: 'https://ssrs.company.com',\n\tSSRS_USERNAME: 'john.doe',\n\tSSRS_PASSWORD: 'supersecret',\n\tSSRS_DOMAIN: 'CORP',\n\tREQUEST_TIMEOUT: 60000,\n\tRETRY_ATTEMPTS: 5,\n\tLOG_LEVEL: 'debug',\n})\n```\n\nThe file will be created with `0600` permissions.  \nThe master key is automatically generated the first time you encrypt data.\n\n**Fallback behaviour:**\n\n- If `NODE_ENV === 'production'` → config file must exist; environment variables are ignored.\n- Otherwise (development) → try config file, fallback to environment variables.\n\n---\n\n## Logging \u0026 Debugging\n\nEnable detailed logging by setting `LOG_LEVEL=trace` in your environment or via `logger.configure()`:\n\n```typescript\nimport { logger } from 'apigsreport'\n\nlogger.configure({ level: 'trace', colors: true, timestamp: true })\n```\n\nThe logger outputs:\n\n- HTTP request/response traces (method, URL, status, duration)\n- Authentication success/failure events\n- Configuration loading details\n- Encryption/decryption steps (without exposing secrets)\n\n**Correlation IDs** are automatically generated for each request – they appear in debug logs to help trace issues.\n\n---\n\n## Development\n\n```bash\ngit clone https://github.com/neuxdotdev/apigsreport.git\ncd apigsreport\nbun install\n\n# Full rebuild (clean, typecheck, bundle, format)\nbun run rebuild\n\n# Run tests (Vitest)\nbun run test\n\n# Run tests with coverage\nbun run test:coverage\n\n# Build library only (CJS, ESM, types)\nbun run build:lib:prod\n\n# Generate API documentation\nbun run docs:full\n```\n\n### Project Structure\n\n```\n.\n├── lib/\n│   ├── functions/          # SSRS API \u0026 NTLM client logic\n│   │   ├── api/            # SsrsApiClient, renderReport, types\n│   │   └── auth/           # AuthManager, NtlmHttpClient\n│   ├── handler/            # Config, Env, Logger, custom Errors\n│   ├── utils/              # crypto (AES‑256‑GCM, master key)\n│   ├── lib.ts              # ApigsReportClient, createClient\n│   └── index.ts            # Public exports\n├── tests/                  # Vitest tests (unit + coverage)\n├── build/                  # Output (CJS, ESM, .d.ts)\n├── package.json\n├── tsconfig.json\n└── rollup.config.mjs\n```\n\n### Scripts\n\n| Command                  | Description                              |\n| ------------------------ | ---------------------------------------- |\n| `bun run clean`          | Remove `build/` and cache                |\n| `bun run typecheck`      | Run `tsc --noEmit`                       |\n| `bun run format`         | Format all files with Prettier           |\n| `bun run build:lib:prod` | Bundle library for production (minified) |\n| `bun run test`           | Run Vitest tests                         |\n| `bun run test:coverage`  | Run tests with coverage report           |\n| `bun run docs:full`      | Generate TypeDoc site and serve locally  |\n| `bun run rebuild`        | Clean → build → format                   |\n| `bun run version:patch`  | Bump patch version                       |\n| `bun run release`        | Publish to npm (runs `prepublishOnly`)   |\n\n---\n\n## Contributing\n\n1. Fork the repository.\n2. Create a feature branch (`git checkout -b feat/your-feature`).\n3. Commit changes using [Conventional Commits](https://www.conventionalcommits.org/).\n4. Run `bun run rebuild` to ensure everything passes.\n5. Push and open a Pull Request.\n\nPlease ensure your code passes type checking, formatting, and all tests.\n\n---\n\n## License\n\n**MIT License** – see [LICENSE](license) for details.\n\n---\n\n## Credits\n\n- Built with [axios-ntlm](https://github.com/cedws/axios-ntlm) for NTLM authentication.\n- Optimised for [Bun](https://bun.sh) runtime and Node.js.\n- Inspired by the need for a robust, type‑safe SSRS client.\n\n---\n\n\u003e **Repository**: https://github.com/neuxdotdev/apigsreport  \n\u003e **Issues**: https://github.com/neuxdotdev/apigsreport/issues  \n\u003e **npm**: https://www.npmjs.com/package/apigsreport  \n\u003e **Documentation**: https://neuxdotdev.github.io/apigsreport/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuxdotdev%2Fapigsreport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneuxdotdev%2Fapigsreport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneuxdotdev%2Fapigsreport/lists"}