{"_id":"@atlascrew/synapse-client","name":"@atlascrew/synapse-client","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@atlascrew/synapse-client","version":"0.1.0","description":"TypeScript client and CLI for Synapse API","author":{"name":"Nicholas Crew Ferguson","email":"nick@atlascrew.dev","url":"https://atlascrew.dev"},"keywords":["security","WAF","CLI","synapse","horizon"],"repository":{"type":"git","url":"git+https://github.com/atlas-crew/horizon-security-platform.git","directory":"apps/synapse-client"},"homepage":"https://horizon.atlascrew.dev/reference/synapse-cli","bugs":{"url":"https://github.com/atlas-crew/horizon-security-platform/issues"},"license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"bin":{"synapse":"dist/cli.js","syn":"dist/cli.js"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"dependencies":{"@atlascrew/synapse-api":"0.1.0"},"devDependencies":{"@types/node":"^20.19.22","@vitest/coverage-v8":"^3.2.4","typescript":"^5.4.0","vitest":"^3.2.4"},"scripts":{"build":"tsc -p .","lint":"echo 'No linter configured'","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage"},"_id":"@atlascrew/synapse-client@0.1.0","_integrity":"sha512-A2TrSx02GbssQxPaU1yBcotVX7NBbuhxowXtCyO5Ddx8DK2tICs5PByVhcAjmkw84LDawn+R6RnSBNPUszck6Q==","_resolved":"/tmp/37f9a81accf15c1a7c1d63fc356d6a02/atlascrew-synapse-client-0.1.0.tgz","_from":"file:atlascrew-synapse-client-0.1.0.tgz","_nodeVersion":"20.20.1","_npmVersion":"10.8.2","dist":{"integrity":"sha512-A2TrSx02GbssQxPaU1yBcotVX7NBbuhxowXtCyO5Ddx8DK2tICs5PByVhcAjmkw84LDawn+R6RnSBNPUszck6Q==","shasum":"da0921ac06bc827d7ca6a34bad62e06d0a7de3de","tarball":"https://registry.npmjs.org/@atlascrew/synapse-client/-/synapse-client-0.1.0.tgz","fileCount":39,"unpackedSize":71285,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDMMoPZjcQniwaMi7LAqX+iwGG8Br9Mzo24vsuXm+o/hQIhAMmABDfWa2UHvjjkF1b8vBJItIjcLsbWrscTnDdfqvxB"}]},"_npmUser":{"name":"nickcrew","email":"nickf4@icloud.com"},"directories":{},"maintainers":[{"name":"nickcrew","email":"nickf4@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/synapse-client_0.1.0_1774419598231_0.017743961125267882"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-25T06:19:58.129Z","0.1.0":"2026-03-25T06:19:58.375Z","modified":"2026-03-25T06:19:58.605Z"},"maintainers":[{"name":"nickcrew","email":"nickf4@icloud.com"}],"description":"TypeScript client and CLI for Synapse API","homepage":"https://horizon.atlascrew.dev/reference/synapse-cli","keywords":["security","WAF","CLI","synapse","horizon"],"repository":{"type":"git","url":"git+https://github.com/atlas-crew/horizon-security-platform.git","directory":"apps/synapse-client"},"author":{"name":"Nicholas Crew Ferguson","email":"nick@atlascrew.dev","url":"https://atlascrew.dev"},"bugs":{"url":"https://github.com/atlas-crew/horizon-security-platform/issues"},"license":"MIT","readme":"# Synapse Client\n\nTypeScript client and CLI for the Synapse (risk-server) API.\n\n## Installation\n\n```bash\n# From the monorepo root\npnpm install\npnpm nx run synapse-client:build\n\n# Run CLI\nnode apps/synapse-client/dist/cli.js --help\n\n# Or link globally\ncd apps/synapse-client && npm link\nsynapse --help\n```\n\n## CLI Usage\n\n```bash\n# Set server URL via environment variable\nexport SYNAPSE_URL=http://localhost:3000\n\n# Check health\nsynapse health\n\n# Get sensor status\nsynapse status\n\n# List entities\nsynapse entities\n\n# Release a blocked entity\nsynapse release 192.168.1.100\n\n# List WAF rules\nsynapse rules\n\n# Evaluate a request against rules\nsynapse evaluate GET \"/api/users?id=1\"\n\n# Get JSON output\nsynapse --json status\n```\n\n### Global Options\n\n| Flag | Env Var | Description |\n|------|---------|-------------|\n| `-u, --url` | `SYNAPSE_URL` | Synapse server URL (required) |\n| `--json` | `SYNAPSE_JSON=1` | Output as JSON |\n| `-d, --debug` | `SYNAPSE_DEBUG=1` | Enable debug logging |\n| `-t, --timeout` | `SYNAPSE_TIMEOUT` | Request timeout in ms (default: 30000) |\n\n### Commands\n\n**Health & Status:**\n- `health` - Check server health\n- `status` - Get sensor status and metrics\n- `metrics` - Get Prometheus-formatted metrics\n\n**Entity Management:**\n- `entities` - List all tracked entities\n- `blocks` - List all block records\n- `release <id|ip>` - Release a blocked entity\n- `release-all` - Release all blocked entities\n\n**Configuration:**\n- `config` - Get system configuration\n- `config-set <key=value>...` - Update configuration\n\n**WAF Rules:**\n- `rules` - List all WAF rules\n- `rule-add <json> [ttl]` - Add a runtime rule\n- `rule-remove <id>` - Remove a runtime rule\n- `rules-clear` - Clear all runtime rules\n- `reload` - Reload rules from file\n- `evaluate <method> <url> [headers-json]` - Evaluate request against rules\n\n**Actor Tracking:**\n- `actors` - List all tracked actors\n- `actor-stats` - Get actor tracking statistics\n- `actor-fingerprint <ip> <fp>` - Set actor fingerprint\n\n## Library Usage\n\n```typescript\nimport { SynapseClient } from 'synapse-client';\n\nconst client = new SynapseClient({\n  baseUrl: 'http://localhost:3000',\n  timeout: 30000,\n  debug: false,\n});\n\n// Check health\nconst health = await client.health();\nconsole.log(health.status);\n\n// Get sensor status\nconst status = await client.getStatus();\nconsole.log(`Total requests: ${status.totalRequests}`);\nconsole.log(`Blocked: ${status.blockedRequests}`);\n\n// List entities\nconst { entities } = await client.listEntities();\nfor (const entity of entities) {\n  console.log(`${entity.ip}: risk=${entity.risk}, blocked=${entity.blocked}`);\n}\n\n// Release a blocked entity\nawait client.releaseEntity('192.168.1.100');\n\n// Add a runtime rule\nawait client.addRule({\n  name: 'Block test path',\n  description: 'Block requests to /test',\n  risk: 100,\n  blocking: true,\n  matches: [{ type: 'uri', match: '/test' }],\n}, 3600); // TTL: 1 hour\n\n// Evaluate a request (dry run)\nconst result = await client.evaluate({\n  method: 'GET',\n  url: '/api/users?id=1',\n});\nconsole.log(`Would block: ${result.wouldBlock}`);\n```\n\n## API Reference\n\n### SynapseClient\n\n#### Constructor Options\n\n```typescript\ninterface SynapseClientOptions {\n  baseUrl: string;     // Synapse server URL\n  timeout?: number;    // Request timeout in ms (default: 30000)\n  debug?: boolean;     // Enable debug logging (default: false)\n}\n```\n\n#### Methods\n\n| Method | Description |\n|--------|-------------|\n| `health()` | Check server health |\n| `getStatus()` | Get sensor status and metrics |\n| `getMetrics()` | Get Prometheus-formatted metrics |\n| `listEntities()` | List all tracked entities |\n| `listBlocks()` | List all block records |\n| `releaseEntity(id)` | Release a blocked entity by ID or IP |\n| `releaseAll()` | Release all blocked entities |\n| `getConfig()` | Get system configuration |\n| `updateConfig(updates)` | Update WAF configuration |\n| `listRules()` | List all WAF rules |\n| `addRule(rule, ttl?)` | Add a runtime rule |\n| `removeRule(id)` | Remove a runtime rule |\n| `clearRules()` | Clear all runtime rules |\n| `reloadRules()` | Reload rules from file |\n| `evaluate(request)` | Evaluate request against rules |\n| `listActors()` | List all tracked actors |\n| `getActorStats()` | Get actor tracking statistics |\n| `setActorFingerprint(ip, fp)` | Set actor fingerprint |\n\n## Development\n\n```bash\n# Install dependencies\ncd apps/synapse-client\nnpm install\n\n# Build\nnpm run build\n\n# Run tests\nnpm test\n\n# Test with coverage\nnpm run test:coverage\n\n# Watch mode\nnpm run test:watch\n```\n\n## License\n\nLicensed under the GNU Affero General Public License v3.0 only.\nSee [LICENSE](../../LICENSE).\n","readmeFilename":"README.md","_rev":"1-7bbf8a48e5c76a832402104f53e367fc"}