{"_id":"@teliagen/plugin-playground","_rev":"35-2e017af2c13ed2ecd507f8ac2851e7cc","name":"@teliagen/plugin-playground","dist-tags":{"latest":"0.4.5"},"versions":{"0.4.0":{"name":"@teliagen/plugin-playground","version":"0.4.0","author":{"name":"Teliagen Team","email":"contact@teliagen.org"},"license":"MIT","_id":"@teliagen/plugin-playground@0.4.0","maintainers":[{"name":"teliagen_off","email":"admin@teliagen.org"}],"homepage":"https://docs.teliagen.org","bugs":{"url":"https://github.com/teliagen/teliagen-framework/issues"},"dist":{"shasum":"b8e0fd1e183e44f1c435a13367af138796f0cd96","tarball":"https://registry.npmjs.org/@teliagen/plugin-playground/-/plugin-playground-0.4.0.tgz","fileCount":5,"integrity":"sha512-xJqMss5M8uXvLxEY7Ej1nu6PppoMPqTSDWj35qrLlKY0aju7pA2RW6wK71/WLpJbL9Sy2tUvd2xglghpttzwPg==","signatures":[{"sig":"MEQCIBLLBVeYqIpQh7TefEpWFGrTAUgcfpmey/zQ88rY+CElAiAD/h9WFsRc6Hl95nBfRlUQG6HhLDlaQaUQjymhWXn8RA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":43696},"main":"dist/index.js","_from":"file:teliagen-plugin-playground-0.4.0.tgz","types":"dist/index.d.ts","private":false,"scripts":{"build":"tsc"},"_npmUser":{"name":"teliagen_off","email":"admin@teliagen.org"},"_resolved":"C:\\Users\\ABDOUL~1\\AppData\\Local\\Temp\\3754a81691e8d0b1ad43cb4109e98c75\\teliagen-plugin-playground-0.4.0.tgz","_integrity":"sha512-xJqMss5M8uXvLxEY7Ej1nu6PppoMPqTSDWj35qrLlKY0aju7pA2RW6wK71/WLpJbL9Sy2tUvd2xglghpttzwPg==","repository":{"url":"git+https://github.com/teliagen/teliagen-plugin.git","type":"git","directory":"packages/plugin-playground"},"_npmVersion":"11.6.2","description":"> Interactive API playground for Teliagen applications.","directories":{},"_nodeVersion":"24.12.0","dependencies":{"@teliagen/logger":"^0.4.0","@teliagen/commons":"^0.4.0","@teliagen/persistence":"^0.4.0"},"publishConfig":{"access":"restricted"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/plugin-playground_0.4.0_1770858386455_0.4508428445810626","host":"s3://npm-registry-packages-npm-production"}},"0.4.5":{"name":"@teliagen/plugin-playground","version":"0.4.5","private":false,"publishConfig":{"access":"restricted"},"main":"dist/index.js","types":"dist/index.d.ts","author":{"name":"Teliagen Team","email":"contact@teliagen.org"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/teliagen/teliagen-plugin.git","directory":"packages/plugin-playground"},"homepage":"https://docs.teliagen.org","bugs":{"url":"https://github.com/teliagen/teliagen-framework/issues"},"dependencies":{"@teliagen/commons":"^0.4.2","@teliagen/logger":"^0.4.2","@teliagen/persistence":"^0.4.2"},"devDependencies":{"typescript":"^5.0.0","@types/node":"^20.0.0"},"scripts":{"build":"tsc"},"_id":"@teliagen/plugin-playground@0.4.5","description":"> Interactive API playground for Teliagen applications.","_integrity":"sha512-plISncz0AHEpZ+ODBirpLKLHLJjQTjF6aKVJmZYI9yGWTVPAkfwdnAfb0cwM9rZiCqQYBOwU4zkLi/oWV81eEg==","_resolved":"C:\\Users\\ABDOUL~1\\AppData\\Local\\Temp\\456a4ce016068153f5f5a14bdc53b30c\\teliagen-plugin-playground-0.4.5.tgz","_from":"file:teliagen-plugin-playground-0.4.5.tgz","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-plISncz0AHEpZ+ODBirpLKLHLJjQTjF6aKVJmZYI9yGWTVPAkfwdnAfb0cwM9rZiCqQYBOwU4zkLi/oWV81eEg==","shasum":"cb265756d5a92146735d9a0ce5177a429e91ab51","tarball":"https://registry.npmjs.org/@teliagen/plugin-playground/-/plugin-playground-0.4.5.tgz","fileCount":8,"unpackedSize":118802,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICtwob204meme7ePAVImUd6PFEzCkVhIFbkFwgAojZ/0AiEA6BSPddCjrk7jIIQ7vtmWCgfpLBWxiuuf2q/fzq1L5Gs="}]},"_npmUser":{"name":"teliagen_off","email":"admin@teliagen.org"},"directories":{},"maintainers":[{"name":"teliagen_off","email":"admin@teliagen.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/plugin-playground_0.4.5_1770928769812_0.3212244742198722"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-12T01:06:26.000Z","modified":"2026-02-12T20:39:30.090Z","0.1.0":"2026-01-19T19:17:26.994Z","0.1.1":"2026-01-19T19:55:55.156Z","0.1.2":"2026-01-19T21:14:33.323Z","0.1.3":"2026-01-19T21:27:29.804Z","0.1.4":"2026-01-20T01:13:02.909Z","0.1.5":"2026-01-20T01:19:21.699Z","0.1.6":"2026-01-20T01:26:24.010Z","0.1.7":"2026-01-20T02:28:47.958Z","0.1.8":"2026-01-20T02:45:42.571Z","0.1.9":"2026-01-25T07:47:53.804Z","0.1.10":"2026-01-25T16:04:25.648Z","0.1.11":"2026-01-25T16:42:23.066Z","0.1.12":"2026-01-25T16:47:08.624Z","0.1.14":"2026-01-25T19:33:55.186Z","0.1.15":"2026-01-25T23:50:27.654Z","0.1.16":"2026-01-26T00:07:30.753Z","0.1.17":"2026-01-26T00:11:14.119Z","0.1.18":"2026-01-26T00:14:34.256Z","0.1.19":"2026-01-26T00:18:46.348Z","0.1.20":"2026-01-26T00:40:08.207Z","0.1.21":"2026-01-26T00:52:48.742Z","0.1.22":"2026-01-26T00:57:03.011Z","0.1.24":"2026-01-26T01:17:27.836Z","0.1.25":"2026-01-26T01:22:00.414Z","0.1.26":"2026-01-26T01:43:03.442Z","0.1.27":"2026-01-26T02:17:49.562Z","0.1.28":"2026-01-26T02:26:10.133Z","0.4.0":"2026-02-12T01:06:26.690Z","0.4.5":"2026-02-12T20:39:29.955Z"},"bugs":{"url":"https://github.com/teliagen/teliagen-framework/issues"},"author":{"name":"Teliagen Team","email":"contact@teliagen.org"},"license":"MIT","homepage":"https://docs.teliagen.org","repository":{"type":"git","url":"git+https://github.com/teliagen/teliagen-plugin.git","directory":"packages/plugin-playground"},"description":"> Interactive API playground for Teliagen applications.","maintainers":[{"name":"teliagen_off","email":"admin@teliagen.org"}],"readme":"# @teliagen/plugin-playground\r\n\r\n> Interactive API playground for Teliagen applications.\r\n\r\n[![npm version](https://img.shields.io/npm/v/@teliagen/plugin-playground.svg)](https://www.npmjs.com/package/@teliagen/plugin-playground)\r\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## Overview\r\n\r\n`@teliagen/plugin-playground` provides an interactive UI for testing your Teliagen actions:\r\n\r\n- **Action Explorer** – Browse all available actions\r\n- **Input Builder** – Auto-generated forms from schemas\r\n- **Response Viewer** – Formatted JSON responses\r\n- **Authentication** – Login and test authenticated actions\r\n- **History** – Request/response history\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @teliagen/plugin-playground\r\n# or\r\npnpm add @teliagen/plugin-playground\r\n```\r\n\r\n## Quick Start\r\n\r\n```typescript\r\nimport { TeliagenApp } from '@teliagen/server';\r\nimport { PlaygroundPlugin } from '@teliagen/plugin-playground';\r\n\r\nconst app = new TeliagenApp();\r\nawait app.initialize();\r\n\r\nconst playground = PlaygroundPlugin({\r\n  name: 'playground',\r\n  path: '/playground'\r\n});\r\n\r\nawait app.registerPlugins([playground]);\r\nawait app.start();\r\n\r\n// Access playground at http://localhost:3000/playground\r\n```\r\n\r\n## Configuration\r\n\r\n```typescript\r\ninterface PlaygroundPluginOptions {\r\n  name: string;                  // Plugin instance name\r\n  path?: string;                 // URL path (default: '/playground')\r\n  \r\n  // Access control\r\n  enabled?: boolean;             // Enable/disable (default: true)\r\n  allowInProduction?: boolean;   // Allow in prod (default: false)\r\n  \r\n  // Authentication\r\n  requireAuth?: boolean;         // Require login (default: false)\r\n  authPlugin?: string;           // Auth plugin name to use\r\n  \r\n  // UI customization\r\n  title?: string;                // Page title\r\n  logo?: string;                 // Logo URL\r\n  theme?: 'light' | 'dark';      // UI theme\r\n}\r\n```\r\n\r\n## Examples\r\n\r\n### Basic Setup\r\n\r\n```typescript\r\nconst playground = PlaygroundPlugin({\r\n  name: 'playground',\r\n  path: '/api/playground',\r\n  title: 'My API Playground'\r\n});\r\n```\r\n\r\n### Protected Playground\r\n\r\n```typescript\r\nconst playground = PlaygroundPlugin({\r\n  name: 'playground',\r\n  requireAuth: true,\r\n  authPlugin: 'auth',  // Use auth plugin for login\r\n  allowInProduction: false\r\n});\r\n```\r\n\r\n### Production Setup\r\n\r\n```typescript\r\nconst playground = PlaygroundPlugin({\r\n  name: 'playground',\r\n  enabled: process.env.NODE_ENV !== 'production',\r\n  // Or allow in production with auth:\r\n  // enabled: true,\r\n  // allowInProduction: true,\r\n  // requireAuth: true\r\n});\r\n```\r\n\r\n## Features\r\n\r\n### Action Explorer\r\n\r\nBrowse all registered actions organized by module and provider:\r\n\r\n```\r\n├── auth (module)\r\n│   └── AuthActions (provider)\r\n│       ├── login\r\n│       ├── register\r\n│       └── refreshToken\r\n├── users\r\n│   └── UserActions\r\n│       ├── listUsers\r\n│       ├── getUser\r\n│       └── updateUser\r\n└── orders\r\n    └── OrderActions\r\n        ├── createOrder\r\n        └── getOrderDetails\r\n```\r\n\r\n### Input Builder\r\n\r\nAuto-generates input forms from your `@Input` schemas:\r\n\r\n```typescript\r\nclass CreateOrderInput {\r\n  @String({ required: true })\r\n  customerId!: string;\r\n\r\n  @Array({ itemType: Object })\r\n  items!: OrderItem[];\r\n\r\n  @String({ optional: true })\r\n  notes?: string;\r\n}\r\n```\r\n\r\nGenerates a form with:\r\n- Text input for `customerId`\r\n- Array builder for `items`\r\n- Optional text area for `notes`\r\n\r\n### Response Viewer\r\n\r\n- Syntax-highlighted JSON\r\n- Collapsible nested objects\r\n- Copy to clipboard\r\n- Response time and status\r\n\r\n### Authentication\r\n\r\nIf `requireAuth` is enabled:\r\n1. User logs in via auth plugin\r\n2. Token is stored in session\r\n3. All requests include auth header\r\n4. Test protected actions easily\r\n\r\n## Accessing Actions via Playground\r\n\r\n```\r\nGET http://localhost:3000/playground\r\n\r\n# Interactive UI at:\r\nhttp://localhost:3000/playground\r\n```\r\n\r\nThe playground fetches action metadata from:\r\n```\r\nGET /teliagen/metadata\r\n```\r\n\r\nEnsure you have `ClientContractSync` or `ServerContractSync` enabled.\r\n\r\n## Security\r\n\r\n**Development Only (Default):**\r\n```typescript\r\nPlaygroundPlugin({\r\n  name: 'playground',\r\n  allowInProduction: false  // Disabled in production\r\n});\r\n```\r\n\r\n**Production with Auth:**\r\n```typescript\r\nPlaygroundPlugin({\r\n  name: 'playground',\r\n  allowInProduction: true,\r\n  requireAuth: true,\r\n  authPlugin: 'auth'\r\n});\r\n```\r\n\r\n**IP Whitelist (Advanced):**\r\n```typescript\r\nPlaygroundPlugin({\r\n  name: 'playground',\r\n  allowInProduction: true,\r\n  middleware: async (ctx, next) => {\r\n    const allowedIPs = ['127.0.0.1', '10.0.0.0/8'];\r\n    if (!isAllowedIP(ctx.ip, allowedIPs)) {\r\n      throw new Error('Access denied');\r\n    }\r\n    await next();\r\n  }\r\n});\r\n```\r\n\r\n## Requirements\r\n\r\n- **Node.js** >= 18.0.0\r\n- **@teliagen/server** >= 0.1.0\r\n\r\n## Related Packages\r\n\r\n- **[@teliagen/plugin-auth](../plugin-auth)** – For authenticated playground\r\n\r\n## Documentation\r\n\r\nFor full documentation, visit [docs.teliagen.org](https://docs.teliagen.org).\r\n\r\n## License\r\n\r\nMIT © Teliagen Contributors\r\n\r\n---\r\n\r\n<p align=\"center\">\r\n  <strong>Part of the <a href=\"https://github.com/teliagen/teliagen-framework\">Teliagen Framework</a></strong>\r\n</p>\r\n","readmeFilename":"README.md"}