{"name":"libnpmorg","version":"9.0.0","description":"Programmatic api for `npm org` commands","author":{"name":"GitHub Inc."},"main":"lib/index.js","keywords":["libnpm","npm","package manager","api","orgs","teams"],"license":"ISC","scripts":{"lint":"npm run eslint","test":"tap","posttest":"npm run lint","postlint":"template-oss-check","lintfix":"npm run eslint -- --fix","snap":"tap","template-oss-apply":"template-oss-apply --force","eslint":"eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""},"devDependencies":{"@npmcli/eslint-config":"^5.0.1","@npmcli/template-oss":"5.1.1","minipass":"^7.1.1","nock":"^14.0.0","tap":"^16.3.8"},"repository":{"type":"git","url":"git+https://github.com/npm/cli.git","directory":"workspaces/libnpmorg"},"bugs":{"url":"https://github.com/npm/libnpmorg/issues"},"homepage":"https://npmjs.com/package/libnpmorg","dependencies":{"aproba":"^2.0.0","npm-registry-fetch":"^20.0.1"},"engines":{"node":"^22.22.2 || ^24.15.0 || >=26.0.0"},"templateOSS":{"//@npmcli/template-oss":"This file is partially managed by @npmcli/template-oss. Edits may be overwritten.","version":"5.1.1","content":"../../scripts/template-oss/index.js"},"tap":{"node-arg":["--require","../../scripts/disable-agent-for-tests.js"],"nyc-arg":["--exclude","tap-snapshots/**"]},"gitHead":"aec197bf5594f0714f3e058415bb98414beab7c0","_id":"libnpmorg@9.0.0","_nodeVersion":"26.0.0","_npmVersion":"12.0.0","dist":{"integrity":"sha512-cPiStT2aFEGu5/so+VZlQDb5AuhiYFsEAHBOCjuXWbBQP2EcGmr6doOUNRV17L2HNTw1Wvqnq2+nSrINdBphAg==","shasum":"a3b4d1a4e09aead1c535be0e6ce5d94bd1e3a9db","tarball":"http://registry-npm.ywwl.com/libnpmorg/download/libnpmorg-9.0.0.tgz","fileCount":4,"unpackedSize":8122,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA21o6lPEG7O5lvtDf+HEo/1sd5PWF/zrsiyHVtYjJbVAiB7u85NYfKL3D+Rew1Zl09mlCSdoQtV9zlj7s8w1qgYzQ=="}],"size":3266,"noattachment":false,"key":"/libnpmorg/-/libnpmorg-9.0.0.tgz"},"_npmUser":{"name":"reggi","email":"reggi@github.com"},"directories":{},"maintainers":[{"name":"saquibkhan","email":"saquibkhan@github.com"},{"name":"npm-cli-ops","email":"npm-cli+bot@github.com"},{"name":"reggi","email":"reggi@github.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/libnpmorg_9.0.0_1783544738400_0.549574104560846"},"_hasShrinkwrap":false,"readme":"# libnpmorg\n\n[![npm version](https://img.shields.io/npm/v/libnpmorg.svg)](https://npm.im/libnpmorg)\n[![license](https://img.shields.io/npm/l/libnpmorg.svg)](https://npm.im/libnpmorg)\n[![CI - libnpmorg](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml/badge.svg)](https://github.com/npm/cli/actions/workflows/ci-libnpmorg.yml)\n\n[`libnpmorg`](https://github.com/npm/libnpmorg) is a Node.js library for\nprogrammatically accessing the [npm Org membership\nAPI](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail).\n\n## Table of Contents\n\n* [Example](#example)\n* [Install](#install)\n* [Contributing](#contributing)\n* [API](#api)\n  * [hook opts](#opts)\n  * [`set()`](#set)\n  * [`rm()`](#rm)\n  * [`ls()`](#ls)\n  * [`ls.stream()`](#ls-stream)\n\n## Example\n\n```js\nconst org = require('libnpmorg')\n\nconsole.log(await org.ls('myorg', {token: 'deadbeef'}))\n=>\nRoster {\n  zkat: 'developer',\n  iarna: 'admin',\n  isaacs: 'owner'\n}\n```\n\n## Install\n\n`$ npm install libnpmorg`\n\n### API\n\n#### <a name=\"opts\"></a> `opts` for `libnpmorg` commands\n\n`libnpmorg` uses [`npm-registry-fetch`](https://npm.im/npm-registry-fetch).\nAll options are passed through directly to that library, so please refer to [its\nown `opts`\ndocumentation](https://www.npmjs.com/package/npm-registry-fetch#fetch-options)\nfor options that can be passed in.\n\nA couple of options of note for those in a hurry:\n\n* `opts.token` - can be passed in and will be used as the authentication token for the registry. For other ways to pass in auth details, see the n-r-f docs.\n* `opts.otp` - certain operations will require an OTP token to be passed in. If a `libnpmorg` command fails with `err.code === EOTP`, please retry the request with `{otp: <2fa token>}`\n\n#### <a name=\"set\"></a> `> org.set(org, user, [role], [opts]) -> Promise`\n\nThe returned Promise resolves to a [Membership\nDetail](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#membership-detail)\nobject.\n\nThe `role` is optional and should be one of `admin`, `owner`, or `developer`.\n`developer` is the default if no `role` is provided.\n\n`org` and `user` must be scope names for the org name and user name\nrespectively. They can optionally be prefixed with `@`.\n\nSee also: [`PUT\n/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-replace)\n\n##### Example\n\n```javascript\nawait org.set('@myorg', '@myuser', 'admin', {token: 'deadbeef'})\n=>\nMembershipDetail {\n  org: {\n    name: 'myorg',\n    size: 15\n  },\n  user: 'myuser',\n  role: 'admin'\n}\n```\n\n#### <a name=\"rm\"></a> `> org.rm(org, user, [opts]) -> Promise`\n\nThe Promise resolves to `null` on success.\n\n`org` and `user` must be scope names for the org name and user name\nrespectively. They can optionally be prefixed with `@`.\n\nSee also: [`DELETE\n/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-membership-delete)\n\n##### Example\n\n```javascript\nawait org.rm('myorg', 'myuser', {token: 'deadbeef'})\n```\n\n#### <a name=\"ls\"></a> `> org.ls(org, [opts]) -> Promise`\n\nThe Promise resolves to a\n[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster)\nobject.\n\n`org` must be a scope name for an org, and can be optionally prefixed with `@`.\n\nSee also: [`GET\n/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster)\n\n##### Example\n\n```javascript\nawait org.ls('myorg', {token: 'deadbeef'})\n=>\nRoster {\n  zkat: 'developer',\n  iarna: 'admin',\n  isaacs: 'owner'\n}\n```\n\n#### <a name=\"ls-stream\"></a> `> org.ls.stream(org, [opts]) -> Stream`\n\nReturns a stream of entries for a\n[Roster](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#roster),\nwith each emitted entry in `[key, value]` format.\n\n`org` must be a scope name for an org, and can be optionally prefixed with `@`.\n\nThe returned stream is a valid `Symbol.asyncIterator`.\n\nSee also: [`GET\n/-/org/:scope/user`](https://github.com/npm/registry/blob/master/docs/orgs/memberships.md#org-roster)\n\n##### Example\n\n```javascript\nfor await (let [user, role] of org.ls.stream('myorg', {token: 'deadbeef'})) {\n  console.log(`user: ${user} (${role})`)\n}\n=>\nuser: zkat (developer)\nuser: iarna (admin)\nuser: isaacs (owner)\n```\n","publish_time":1783544738589,"_cnpm_publish_time":1783544738589,"dist-tags":{"backport":"5.0.5","latest":"9.0.0","prerelease":"9.0.0-pre.0"}}