{"_id":"@akashbro/saiyandb","_rev":"2-0497f4332bb707117c62e644c0323bb4","name":"@akashbro/saiyandb","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.2":{"name":"@akashbro/saiyandb","version":"0.1.2","keywords":["postgres","dal","nodejs","failover","cloud-agnostic"],"author":{"url":"https://www.linkedin.com/in/akashpaudel/","name":"Akash Paudel","email":"akash.chhetri1@gmail.com"},"license":"MIT","_id":"@akashbro/saiyandb@0.1.2","maintainers":[{"name":"akashbro","email":"akash.chhetri1@gmail.com"}],"homepage":"https://github.com/akashpaudel/saiyandb","bugs":{"url":"https://github.com/akashpaudel/saiyandb/issues"},"dist":{"shasum":"68206983b566b7dd8810bc5eb3019f08f18835b5","tarball":"https://registry.npmjs.org/@akashbro/saiyandb/-/saiyandb-0.1.2.tgz","fileCount":38,"integrity":"sha512-lllo13hebMftm+tN5ucGxW5Uic3M6cPWI45dzks4kd4eo6Hzs8qsBJ+YcHjGeD1mW2UQM1GZfiwlHUT4lCKJZQ==","signatures":[{"sig":"MEQCIC0UVGGswUdO5qZbklVgEJo4K+GjF2MCzqWdoDYLnk6SAiA22wKQ1S3yhjPZzeYp9ypbLwWNLCN/biZBXQ/KT3TjVg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65254},"main":"dist/src/index.js","types":"dist/src/index.d.ts","engines":{"npm":">=10.0.0","node":">=22.0.0"},"exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"gitHead":"3a751a85ab5803a4e5bb7b672884263d3c3e6fda","scripts":{"lint":"eslint .","test":"npm run test:unit","build":"tsc -p tsconfig.json","clean":"rm -rf dist","format":"prettier --write .","example":"tsx examples/basic.ts","prepare":"husky","lint:fix":"eslint . --fix","test:unit":"tsx --test tests/*.test.ts","typecheck":"tsc -p tsconfig.json --noEmit","example:yaml":"tsx examples/from-yaml.ts","format:check":"prettier --check .","release:auto":"./scripts/release.sh release","integration:up":"docker compose -f docker/integration/docker-compose.yml up -d primary-db failover-1-db failover-2-db","prepublishOnly":"npm run lint && npm run format:check && npm run typecheck && npm run build && npm run test:unit","example:failover":"tsx examples/failover-simulated.ts","integration:down":"docker compose -f docker/integration/docker-compose.yml down -v","test:integration":"tsx --test tests/integration/**/*.test.ts","release:auto:dry-run":"./scripts/release.sh release --dry-run","test:integration:docker":"docker compose -f docker/integration/docker-compose.yml run --rm --build test-runner"},"_npmUser":{"name":"akashbro","email":"akash.chhetri1@gmail.com"},"repository":{"url":"git+https://github.com/akashpaudel/saiyandb.git","type":"git"},"_npmVersion":"10.9.2","description":"Cloud-agnostic DB DAL for Node.js with pg support, failover, and YAML+env config.","directories":{},"lint-staged":{"*.ts":["eslint --fix"],"*.{ts,js,json,md,yml,yaml}":["prettier --write"]},"_nodeVersion":"23.11.0","dependencies":{"pg":"^8.16.3","yaml":"^2.8.2","dotenv":"^17.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.20.5","husky":"^9.1.7","eslint":"^9.38.0","prettier":"^3.6.2","@types/pg":"^8.18.0","typescript":"^5.9.2","@types/node":"^25.5.0","lint-staged":"^16.2.4","eslint-config-prettier":"^10.1.8","@typescript-eslint/parser":"^8.46.0","@typescript-eslint/eslint-plugin":"^8.46.0"},"_npmOperationalInternal":{"tmp":"tmp/saiyandb_0.1.2_1773378021105_0.5036194059409844","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@akashbro/saiyandb","version":"0.1.3","description":"Cloud-agnostic DB DAL for Node.js with pg support, failover, and YAML+env config.","main":"dist/src/index.js","types":"dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","format":"prettier --write .","format:check":"prettier --check .","lint":"eslint .","lint:fix":"eslint . --fix","prepare":"husky","test":"npm run test:unit","test:unit":"tsx --test tests/*.test.ts","test:integration":"tsx --test tests/integration/**/*.test.ts","integration:up":"docker compose -f docker/integration/docker-compose.yml up -d primary-db failover-1-db failover-2-db","integration:down":"docker compose -f docker/integration/docker-compose.yml down -v","test:integration:docker":"docker compose -f docker/integration/docker-compose.yml run --rm --build test-runner","typecheck":"tsc -p tsconfig.json --noEmit","verify":"npm run lint && npm run format:check && npm run typecheck && npm run build && npm run test:unit","prepublishOnly":"npm run verify","release:auto":"./scripts/release.sh release","release:auto:dry-run":"./scripts/release.sh release --dry-run"},"keywords":["postgres","dal","nodejs","failover","cloud-agnostic"],"author":{"name":"Akash Paudel","email":"akash.chhetri1@gmail.com","url":"https://www.linkedin.com/in/akashpaudel/"},"homepage":"https://github.com/akashpaudel/saiyandb","repository":{"type":"git","url":"git+https://github.com/akashpaudel/saiyandb.git"},"bugs":{"url":"https://github.com/akashpaudel/saiyandb/issues"},"publishConfig":{"access":"public"},"engines":{"node":">=22.0.0","npm":">=10.0.0"},"license":"MIT","dependencies":{"dotenv":"^17.3.1","pg":"^8.16.3","yaml":"^2.8.2"},"devDependencies":{"@types/node":"^25.5.0","@types/pg":"^8.18.0","@typescript-eslint/eslint-plugin":"^8.46.0","@typescript-eslint/parser":"^8.46.0","eslint":"^9.38.0","eslint-config-prettier":"^10.1.8","husky":"^9.1.7","lint-staged":"^16.2.4","prettier":"^3.6.2","tsx":"^4.20.5","typescript":"^5.9.2"},"lint-staged":{"*.{ts,js,json,md,yml,yaml}":["prettier --write"],"*.ts":["eslint --fix"]},"_id":"@akashbro/saiyandb@0.1.3","gitHead":"2f8624e8fda71b07957ac0e69be6fd30aaf0d9db","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-TE6REx1OKevgdt0Fp6d355WOH7kh59m7llJF6OmjgehG2AwHIv2Wk8JrHAAKueegZ51AkzSrcA6FxkgnCZdxPw==","shasum":"146ecba47c13df7ae303520379bbd37f7d2b3643","tarball":"https://registry.npmjs.org/@akashbro/saiyandb/-/saiyandb-0.1.3.tgz","fileCount":38,"unpackedSize":66741,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIB5ULgKGZF4fpp7q+GCuioCueSiUssOkR8dBOUF6ITz/AiB7aLZBYqGjw/IJ91dV4tGUMhNknLJTqk3lg0F/Ok8c/A=="}]},"_npmUser":{"name":"akashbro","email":"akash.chhetri1@gmail.com"},"directories":{},"maintainers":[{"name":"akashbro","email":"akash.chhetri1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/saiyandb_0.1.3_1773380191716_0.9603255872289729"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-13T05:00:21.021Z","modified":"2026-03-13T05:36:31.957Z","0.1.2":"2026-03-13T05:00:21.250Z","0.1.3":"2026-03-13T05:36:31.851Z"},"bugs":{"url":"https://github.com/akashpaudel/saiyandb/issues"},"author":{"name":"Akash Paudel","email":"akash.chhetri1@gmail.com","url":"https://www.linkedin.com/in/akashpaudel/"},"license":"MIT","homepage":"https://github.com/akashpaudel/saiyandb","keywords":["postgres","dal","nodejs","failover","cloud-agnostic"],"repository":{"type":"git","url":"git+https://github.com/akashpaudel/saiyandb.git"},"description":"Cloud-agnostic DB DAL for Node.js with pg support, failover, and YAML+env config.","maintainers":[{"name":"akashbro","email":"akash.chhetri1@gmail.com"}],"readme":"# SaiyanDB\n\nOpen-source Node.js DAL wrapper that can automatically fail over from an unhealthy primary database to ordered failover databases.\n\nCurrent database support: `pg` only.\n\nBuilt using a Vibe Engineering approach to iterate quickly and ship fast while keeping reliability-focused failover behavior.\n\n## Core Behavior\n\n- Attempts `primary` first for each query.\n- If `primary` fails, tries `failovers` in configured order.\n- Applies `primaryRetryCooldownMs` after primary failures to avoid immediate hot-loop retries.\n- Returns query result plus execution metadata (`queryId`, provider used, duration, attempt).\n- Throws a combined error if all providers fail.\n\n## Requirements\n\n- Node.js `>=22`\n- npm `>=10`\n- Reachable PostgreSQL instances for local/integration testing\n\n## Installation\n\n### Option A: Use from source\n\n```bash\ngit clone https://github.com/akashpaudel/saiyandb.git\ncd saiyandb\nnpm install\nnpm run build\n```\n\n### Option B: Install from npm\n\n```bash\nnpm install @akashbro/saiyandb\n```\n\n## Quick Usage\n\n```ts\nimport { createDALFromYaml } from \"@akashbro/saiyandb\";\n\nconst dal = await createDALFromYaml(\"./config/db.config.yaml\", {\n  envFilePath: \".env\",\n  strict: true,\n  namingStandard: \"kebab-case\"\n});\n\nconst health = await dal.health();\nconsole.log(health.overallHealthy);\n\nconst response = await dal.query(\"SELECT now()\");\nconsole.log(response.meta.providerName);\nconsole.log(response.result.rows);\n\nawait dal.close();\n```\n\n## API Surface\n\n- `createDALFromYaml(path, options?)`: create DAL from YAML topology + env references.\n- `dal.query(sql, params?)`: execute SQL with automatic failover.\n- `dal.getById(table, id)`: helper for `SELECT ... WHERE id = $1 LIMIT 1`.\n- `dal.insert(table, data)`: helper for `INSERT ... RETURNING *`.\n- `dal.health()`: health snapshot for primary + failovers.\n- `dal.close()`: close all database pools.\n\n## Documentation\n\n- `docs/quickstart.md`\n- `docs/configuration.md`\n- `docs/integration-testing.md`\n- `CONTRIBUTING.md`\n\n## Project readiness check\n\n```bash\nnpm run verify\n```\n\n`verify` runs lint, formatting checks, type checks, build, and unit tests in one command.\n\n## Integration Tests (Docker)\n\n```bash\nnpm run integration:up\nnpm run test:integration:docker\nnpm run integration:down\n```\n\n## Playground (published package)\n\nUse the standalone playground in `playground` to test the latest published\n`@akashbro/saiyandb` against multiple Postgres providers.\n\n```bash\ncd playground\nnpm run init\nnpm run start\nnpm run db:down\n```\n\nSee `playground/README.md` for full instructions.\n\n## Versioning and publishing\n\nUse semantic versioning with the release script:\n\n```bash\n# one command: determine bump from last commit and publish\nnpm run release:auto\n\n# dry-run variant\nnpm run release:auto:dry-run\n```\n\nFor CI pipelines, call `./scripts/release.sh release` directly.\n\n`release:auto` follows Conventional Commits on the latest commit:\n\n- `major`: commit has `BREAKING CHANGE` or uses `!` in the type (for example `feat!: ...`)\n- `minor`: commit type is `feat`\n- `patch`: default fallback\n\n`release:auto` also creates a git commit for version files:\n\n- `package.json`\n- `package-lock.json`\n\n## License\n\nMIT\n","readmeFilename":"README.md"}