{"_id":"@115studio/3x-ui-patch","_rev":"2-72c64c6384ba28ad6afb6efa1d20f664","name":"@115studio/3x-ui-patch","dist-tags":{"latest":"2.2.3"},"versions":{"2.2.2":{"name":"@115studio/3x-ui-patch","version":"2.2.2","keywords":["xray","x-ui","3x-ui","3x-ui-js"],"author":{"url":"https://github.com/mehdikhody","name":"Mehdi Khodayari","email":"khodayari.khoram@gmail.com"},"_id":"@115studio/3x-ui-patch@2.2.2","maintainers":[{"name":"mirdukkk","email":"love@deleter.xyz"}],"homepage":"https://github.com/mehdikhody/3x-ui-js#readme","bugs":{"url":"https://github.com/mehdikhody/3x-ui-js/issues"},"dist":{"shasum":"73b07b8e4753a064a3e3f7580905d8fd4a65e92f","tarball":"https://registry.npmjs.org/@115studio/3x-ui-patch/-/3x-ui-patch-2.2.2.tgz","fileCount":33,"integrity":"sha512-J0Qbfqq+K1PhIUrovlfXRIkvJRK1vE0uGFq/yhQ3H3MdfABt6CrnbCnrKLql1ONhHuBqld+sHMdDtqX083OQXg==","signatures":[{"sig":"MEQCIAJTKfLEEFuO7k95UEgsuCwuQoNZnoUpNYg8uz1BROSdAiBNOgL1qKQ9Bi/HUfL9PxGlzj/OglUs0Leoe9hjrp6lpA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40002},"main":"build/index.js","type":"module","types":"build/index.d.ts","gitHead":"936c0ea38ecda2831a3c770c90f9f672665d8560","scripts":{"test":"vitest .","build":"tsc -p tsconfig.build.json && resolve-tspaths","format":"prettier --write ."},"_npmUser":{"name":"mirdukkk","email":"love@deleter.xyz"},"repository":{"url":"git+https://github.com/mehdikhody/3x-ui-js.git","type":"git"},"_npmVersion":"11.6.0","description":"This is an interface for 3x-ui panel. It will help developers to create, edit and delete inbounds and clients in a simple way.","directories":{},"_nodeVersion":"24.9.0","dependencies":{"qs":"^6.11.2","axios":"^1.6.4","winston":"^3.11.0","url-join":"^5.0.0","node-cache":"^5.1.2","async-mutex":"^0.5.0","proxy-agent":"^6.3.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.6.2","zod":"^3.23.8","eslint":"^8.55.0","vitest":"^2.1.2","prettier":"^3.1.0","xray-zod":"^1.0.0","@types/qs":"^6.9.11","typescript":"^5.3.3","@types/node":"^20.16.11","@faker-js/faker":"^9.0.3","resolve-tspaths":"^0.8.22","vite-tsconfig-paths":"^5.0.1","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/parser":"^6.13.2","@typescript-eslint/eslint-plugin":"^6.13.2"},"_npmOperationalInternal":{"tmp":"tmp/3x-ui-patch_2.2.2_1760956470649_0.8681093270428677","host":"s3://npm-registry-packages-npm-production"}},"2.2.3":{"name":"@115studio/3x-ui-patch","description":"This is an interface for 3x-ui panel. It will help developers to create, edit and delete inbounds and clients in a simple way.","version":"2.2.3","type":"module","main":"build/index.js","types":"build/index.d.ts","publishConfig":{"access":"public"},"author":{"name":"Mehdi Khodayari","email":"khodayari.khoram@gmail.com","url":"https://github.com/mehdikhody"},"scripts":{"build":"tsc -p tsconfig.build.json && resolve-tspaths","format":"prettier --write .","test":"vitest ."},"devDependencies":{"@faker-js/faker":"^9.0.3","@types/node":"^20.16.11","@types/qs":"^6.9.11","@typescript-eslint/eslint-plugin":"^6.13.2","@typescript-eslint/parser":"^6.13.2","eslint":"^8.55.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.0.1","prettier":"^3.1.0","resolve-tspaths":"^0.8.22","tsx":"^4.6.2","typescript":"^5.3.3","vite-tsconfig-paths":"^5.0.1","vitest":"^2.1.2","xray-zod":"^1.0.0","zod":"^3.23.8"},"dependencies":{"async-mutex":"^0.5.0","axios":"^1.6.4","node-cache":"^5.1.2","proxy-agent":"^6.3.1","qs":"^6.11.2","url-join":"^5.0.0","winston":"^3.11.0"},"keywords":["xray","x-ui","3x-ui","3x-ui-js"],"repository":{"type":"git","url":"git+https://github.com/mehdikhody/3x-ui-js.git"},"_id":"@115studio/3x-ui-patch@2.2.3","gitHead":"936c0ea38ecda2831a3c770c90f9f672665d8560","bugs":{"url":"https://github.com/mehdikhody/3x-ui-js/issues"},"homepage":"https://github.com/mehdikhody/3x-ui-js#readme","_nodeVersion":"24.9.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-nuTcGsDUJ2P5/W0TnvIMaAvLDjZL/aHNYDhESCKUXxo9IQ+ll06CYgYU1aV6A3LKd56YzaRfW9HhsnIbNzJCyg==","shasum":"e9db27e7ffdcba71e9e4c63b448ab922aa7ce822","tarball":"https://registry.npmjs.org/@115studio/3x-ui-patch/-/3x-ui-patch-2.2.3.tgz","fileCount":33,"unpackedSize":40002,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC7BDrMKhgXsFVxK/hgZeg+5O0maasm3g/DGl0e9lYK7AIhALQTtUR1Y986FJvyQSUqVnuKx7wZqB8mhKQFFsTiPSg3"}]},"_npmUser":{"name":"mirdukkk","email":"love@deleter.xyz"},"directories":{},"maintainers":[{"name":"mirdukkk","email":"love@deleter.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/3x-ui-patch_2.2.3_1760957492657_0.030678399648733423"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-20T10:34:30.584Z","modified":"2025-10-20T10:51:33.073Z","2.2.2":"2025-10-20T10:34:30.845Z","2.2.3":"2025-10-20T10:51:32.857Z"},"bugs":{"url":"https://github.com/mehdikhody/3x-ui-js/issues"},"author":{"name":"Mehdi Khodayari","email":"khodayari.khoram@gmail.com","url":"https://github.com/mehdikhody"},"homepage":"https://github.com/mehdikhody/3x-ui-js#readme","keywords":["xray","x-ui","3x-ui","3x-ui-js"],"repository":{"type":"git","url":"git+https://github.com/mehdikhody/3x-ui-js.git"},"description":"This is an interface for 3x-ui panel. It will help developers to create, edit and delete inbounds and clients in a simple way.","maintainers":[{"name":"mirdukkk","email":"love@deleter.xyz"}],"readme":"# 3x-ui Node.js SDK\n\nThe 3x-ui is a JavaScript library designed to facilitate communication with the [3x-ui panel](https://github.com/MHSanaei/3x-ui), which runs Xray Core for proxy services. This SDK empowers JavaScript developers to create bots and websites for both commercial and non-commercial uses, providing simplicity, abstraction around the API, caching for improved performance, and mutex for asynchronous safety.\n\nThis package is developed based on [MHSanaei Postman Collection](https://documenter.getpostman.com/view/16802678/2s9YkgD5jm#9cac8101-017e-4415-94e2-d30f4dcf49de) and you can check it out for more information.\n\n### Features\n\n-   ✅ **Simplicity**: Designed with simplicity in mind to streamline the process of interacting with the 3x-ui panel.\n-   ✅ **Abstraction**: Provides an abstraction layer around the 3x-ui API to simplify finding clients by email, uuid (vmess, vless) or password (trojan).\n-   ✅ **Proxy:** Utilizes an underlying proxy agent for communication with the panel if needed.\n-   ✅ **Caching:** Caches responses for improved performance.\n-   ✅ **Mutex:** Provides a mutex, a lock mechanism, to ensure asynchronous safety and prevent race conditions.\n-   ✅ **Debug Mode:** Enables debug mode for detailed logging.\n-   ✅ **TTL:** Allows you to set the cache time in seconds.\n\n## Installation\n\nTo install the 3x-ui SDK, use npm:\n\n```bash\nnpm install 3x-ui\n```\n\n## Usage\n\nFirst, import the SDK:\n\n```js\nimport { XuiApi } from \"3x-ui\";\n```\n\nInitialize the SDK with the URL of your 3x-ui panel:\n\n```js\nconst api = new XuiApi(\"http://username:password@localhost:2053\");\napi.debug = true; // Enables debug mode - defualt is false\napi.stdTTL = 60; // Cache time in seconds - default is 10s\n```\n\nThen, you can utilize the SDK functions:\n\n```js\nconst inbounds = await api.getInbounds();\nconst clientStat = await api.getClient(\"email or clientId\");\nconst clientOptions = await api.getClientOptions(\"email or clientId\");\nconst onlines = await api.getOnlineClients();\n```\n\n## Proxy\n\nThe SDK uses an underlying proxy agent to connect to the panel. You can specify the proxy settings using environment variables such as HTTP_PROXY and HTTPS_PROXY. Refer to the proxy-agent [documentation](https://www.npmjs.com/package/proxy-agent) for more information.\n\n```env\nHTTP_PROXY=\"http://proxy-server-over-tcp.com:3128\"\nHTTPS_PROXY=\"https://proxy-server-over-tls.com:3129\"\n```\n\n## API\n\n### Inbounds\n\n-   `getInbounds()`: Returns an array of all inbounds.\n-   `getInbound(id: number)`: Returns the inbound with the specified ID.\n-   `addInbound(options: InboundOptions)`: Adds a new inbound with the provided options.\n-   `updateInbound(id: number, options: Partial<InboundOptions>)`: Updates the inbound with the specified ID using the provided options.\n-   `resetInboundsStat()`: Resets statistics for all inbounds.\n-   `resetInboundStat(id: number)`: Resets statistics for the inbound with the specified ID.\n-   `deleteInbound(id: number)`: Deletes the inbound with the specified ID.\n\n### Clients\n\n-   `getClient(clientId: string)`: Returns a client with the given `email` or `clientId`.\n-   `getClientIps(clientId: string)`: Returns all client's IPs with the given `email` or `clientId`.\n-   `getClientOptions(clientId: string)`: Returns all client's options with the given `email` or `clientId`.\n-   `addClient(inboundId: number, options: ClientOptions)`: Adds a new client with the given options.\n-   `updateClient(clientId: string, options: Partial<ClientOptions>)`: Updates a client with the given `email` or `clientId`.\n-   `resetClientIps(clientId: string)`: Resets all client's IPs with the given `email` or `clientId`.\n-   `resetClientStat(clientId: string)`: Resets a client's stat with the given `email` or `clientId`.\n-   `deleteClient(clientId: string)`: Deletes a client with the given `email` or `clientId`.\n-   `deleteDepletedClients()`: Deletes all clients that have depleted their traffic.\n-   `deleteInboundDepletedClients(inboundId: number)`: Deletes all clients of an inbound that have depleted their traffic.\n-   `getOnlineClients()`: Returns all online clients.\n\n### Other Functions\n\n-   `sendBackup()`: send backup file via Telegram bot.\n\n## Example\n\nFor more examples, check out [the test directory on our GitHub repository](https://github.com/mehdikhody/3x-ui-js/tree/master/tests).\n","readmeFilename":"README.md"}