@bevry/github-members
Advanced tools
Comparing version 5.0.0 to 5.1.0-next.1628133868.595aa85b7f826f1e6b8262c315e5ae9577faf443
import type { StrictUnion } from 'simplytyped'; | ||
import Fellow from 'fellow'; | ||
import { GitHubCredentials } from '@bevry/github-api'; | ||
/** Options for queries that return multiple results. */ | ||
export interface MultiOptions { | ||
/** If you wish to skip the first page, then set this param, defaults to 1 */ | ||
page?: number; | ||
/** If you wish to change the amount of items returned per page, then set this param */ | ||
size?: number; | ||
/** If you wish to fetch unlimited pages, set this to zero, if you wish to fetch a specific amount of pages, then set this accordingly, defaults to `10` */ | ||
pages?: number; | ||
/** How many requests to make at once, defaults to `0` which is unlimited. */ | ||
concurrency?: number; | ||
} | ||
/** Collection of fellows */ | ||
@@ -76,3 +87,3 @@ export declare type Fellows = Set<Fellow>; | ||
/** | ||
* Fetch the full profile information for a member | ||
* Fetch the full profile information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
@@ -83,14 +94,21 @@ * @param credentials custom github credentials, omit to use the environment variables | ||
/** | ||
* Fetch members from a GitHub organization | ||
* Fetch the parsed information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export declare function getMember(url: string, credentials?: GitHubCredentials): Promise<Fellow>; | ||
/** | ||
* Fetch members from a GitHub organization. | ||
* @param org the org to fetch the members for, e.g. `"bevry"` | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export declare function getMembersFromOrg(org: string, credentials?: GitHubCredentials): Promise<Fellows>; | ||
export declare function getMembersFromOrg(org: string, opts?: MultiOptions, credentials?: GitHubCredentials): Promise<Fellows>; | ||
/** | ||
* Fetch members from GitHub organizations with duplicates removed | ||
* @param org the orgs to fetch the members for, e.g. `["bevry", "browserstate"]` | ||
* @param concurrency custom concurrency to use, defaults to `0` which is infinite | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export declare function getMembersFromOrgs(orgs: Array<string>, concurrency?: number, credentials?: GitHubCredentials): Promise<Fellows>; | ||
export declare function getMembersFromOrgs(orgs: Array<string>, opts?: MultiOptions, credentials?: GitHubCredentials): Promise<Fellows>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -5,6 +5,7 @@ /* eslint camelcase:0 */ | ||
import { query } from '@bevry/github-api'; | ||
import { append } from '@bevry/list'; | ||
/** Export the Fellow class we have imported and are using, such that consumers of this package and ensure they are interacting with the same singletons */ | ||
export { Fellow }; | ||
/** | ||
* Fetch the full profile information for a member | ||
* Fetch the full profile information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
@@ -28,12 +29,44 @@ * @param credentials custom github credentials, omit to use the environment variables | ||
/** | ||
* Fetch members from a GitHub organization | ||
* Fetch the parsed information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMember(url, credentials) { | ||
const profile = await getMemberProfile(url, credentials); | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
} | ||
/** | ||
* Fetch members from a GitHub organization. | ||
* @param org the org to fetch the members for, e.g. `"bevry"` | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMembersFromOrg(org, credentials) { | ||
// Fetch | ||
export async function getMembersFromOrg(org, opts = {}, credentials) { | ||
// defaults | ||
if (opts.page == null) | ||
opts.page = 1; | ||
if (opts.pages == null) | ||
opts.pages = 10; | ||
if (opts.size == null) | ||
opts.size = 100; | ||
// fetch | ||
// https://docs.github.com/en/rest/reference/orgs#list-public-organization-members | ||
const resp = await query({ | ||
pathname: `orgs/${org}/public_members`, | ||
searchParams: { | ||
per_page: '100', | ||
page: String(opts.page), | ||
per_page: String(opts.size), | ||
}, | ||
@@ -44,30 +77,24 @@ userAgent: '@bevry/github-members', | ||
const data = await resp.json(); | ||
// Check | ||
if (data.message) { | ||
return Promise.reject(new Error(data.message)); | ||
} | ||
else if (!Array.isArray(data)) { | ||
return Promise.reject(new Error('response was not an array of members')); | ||
} | ||
else if (data.length === 0) { | ||
return new Set(); | ||
} | ||
// Process | ||
return new Set(await Promise.all(data.map(async function (contributor) { | ||
const profile = await getMemberProfile(contributor.url, credentials); | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
}))); | ||
// prepare | ||
const results = new Set(); | ||
// check | ||
if (data.message) | ||
throw new Error(data.message); | ||
if (!Array.isArray(data)) | ||
throw new Error('response was not an array of members'); | ||
if (data.length === 0) | ||
return results; | ||
// add these items | ||
const pool = new Pool(opts.concurrency); | ||
append(results, await Promise.all(data.map((contributor) => pool.open(() => getMember(contributor.url, credentials))))); | ||
// add next items | ||
const within = opts.pages === 0 || opts.page < opts.pages; | ||
const anotherPage = data.length === opts.size && within; | ||
if (anotherPage) | ||
append(results, await getMembersFromOrg(org, { | ||
...opts, | ||
page: opts.page + 1, | ||
}, credentials)); | ||
// return it all | ||
return results; | ||
} | ||
@@ -77,8 +104,8 @@ /** | ||
* @param org the orgs to fetch the members for, e.g. `["bevry", "browserstate"]` | ||
* @param concurrency custom concurrency to use, defaults to `0` which is infinite | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMembersFromOrgs(orgs, concurrency = 0, credentials) { | ||
const pool = new Pool(concurrency); | ||
return Fellow.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, credentials))))); | ||
export async function getMembersFromOrgs(orgs, opts = {}, credentials) { | ||
const pool = new Pool(opts.concurrency); | ||
return Fellow.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, opts, credentials))))); | ||
} |
@@ -5,6 +5,7 @@ /* eslint camelcase:0 */ | ||
import { query } from '@bevry/github-api'; | ||
import { append } from '@bevry/list'; | ||
/** Export the Fellow class we have imported and are using, such that consumers of this package and ensure they are interacting with the same singletons */ | ||
export { Fellow }; | ||
/** | ||
* Fetch the full profile information for a member | ||
* Fetch the full profile information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
@@ -28,12 +29,44 @@ * @param credentials custom github credentials, omit to use the environment variables | ||
/** | ||
* Fetch members from a GitHub organization | ||
* Fetch the parsed information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMember(url, credentials) { | ||
const profile = await getMemberProfile(url, credentials); | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
} | ||
/** | ||
* Fetch members from a GitHub organization. | ||
* @param org the org to fetch the members for, e.g. `"bevry"` | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMembersFromOrg(org, credentials) { | ||
// Fetch | ||
export async function getMembersFromOrg(org, opts = {}, credentials) { | ||
// defaults | ||
if (opts.page == null) | ||
opts.page = 1; | ||
if (opts.pages == null) | ||
opts.pages = 10; | ||
if (opts.size == null) | ||
opts.size = 100; | ||
// fetch | ||
// https://docs.github.com/en/rest/reference/orgs#list-public-organization-members | ||
const resp = await query({ | ||
pathname: `orgs/${org}/public_members`, | ||
searchParams: { | ||
per_page: '100', | ||
page: String(opts.page), | ||
per_page: String(opts.size), | ||
}, | ||
@@ -44,30 +77,24 @@ userAgent: '@bevry/github-members', | ||
const data = await resp.json(); | ||
// Check | ||
if (data.message) { | ||
return Promise.reject(new Error(data.message)); | ||
} | ||
else if (!Array.isArray(data)) { | ||
return Promise.reject(new Error('response was not an array of members')); | ||
} | ||
else if (data.length === 0) { | ||
return new Set(); | ||
} | ||
// Process | ||
return new Set(await Promise.all(data.map(async function (contributor) { | ||
const profile = await getMemberProfile(contributor.url, credentials); | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
}))); | ||
// prepare | ||
const results = new Set(); | ||
// check | ||
if (data.message) | ||
throw new Error(data.message); | ||
if (!Array.isArray(data)) | ||
throw new Error('response was not an array of members'); | ||
if (data.length === 0) | ||
return results; | ||
// add these items | ||
const pool = new Pool(opts.concurrency); | ||
append(results, await Promise.all(data.map((contributor) => pool.open(() => getMember(contributor.url, credentials))))); | ||
// add next items | ||
const within = opts.pages === 0 || opts.page < opts.pages; | ||
const anotherPage = data.length === opts.size && within; | ||
if (anotherPage) | ||
append(results, await getMembersFromOrg(org, { | ||
...opts, | ||
page: opts.page + 1, | ||
}, credentials)); | ||
// return it all | ||
return results; | ||
} | ||
@@ -77,8 +104,8 @@ /** | ||
* @param org the orgs to fetch the members for, e.g. `["bevry", "browserstate"]` | ||
* @param concurrency custom concurrency to use, defaults to `0` which is infinite | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMembersFromOrgs(orgs, concurrency = 0, credentials) { | ||
const pool = new Pool(concurrency); | ||
return Fellow.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, credentials))))); | ||
export async function getMembersFromOrgs(orgs, opts = {}, credentials) { | ||
const pool = new Pool(opts.concurrency); | ||
return Fellow.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, opts, credentials))))); | ||
} |
@@ -7,3 +7,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getMembersFromOrgs = exports.getMembersFromOrg = exports.getMemberProfile = exports.Fellow = void 0; | ||
exports.getMembersFromOrgs = exports.getMembersFromOrg = exports.getMember = exports.getMemberProfile = exports.Fellow = void 0; | ||
const fellow_1 = __importDefault(require("fellow")); | ||
@@ -13,4 +13,5 @@ exports.Fellow = fellow_1.default; | ||
const github_api_1 = require("@bevry/github-api"); | ||
const list_1 = require("@bevry/list"); | ||
/** | ||
* Fetch the full profile information for a member | ||
* Fetch the full profile information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
@@ -35,12 +36,45 @@ * @param credentials custom github credentials, omit to use the environment variables | ||
/** | ||
* Fetch members from a GitHub organization | ||
* Fetch the parsed information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
async function getMember(url, credentials) { | ||
const profile = await getMemberProfile(url, credentials); | ||
const fellow = fellow_1.default.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
} | ||
exports.getMember = getMember; | ||
/** | ||
* Fetch members from a GitHub organization. | ||
* @param org the org to fetch the members for, e.g. `"bevry"` | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
async function getMembersFromOrg(org, credentials) { | ||
// Fetch | ||
async function getMembersFromOrg(org, opts = {}, credentials) { | ||
// defaults | ||
if (opts.page == null) | ||
opts.page = 1; | ||
if (opts.pages == null) | ||
opts.pages = 10; | ||
if (opts.size == null) | ||
opts.size = 100; | ||
// fetch | ||
// https://docs.github.com/en/rest/reference/orgs#list-public-organization-members | ||
const resp = await github_api_1.query({ | ||
pathname: `orgs/${org}/public_members`, | ||
searchParams: { | ||
per_page: '100', | ||
page: String(opts.page), | ||
per_page: String(opts.size), | ||
}, | ||
@@ -51,30 +85,24 @@ userAgent: '@bevry/github-members', | ||
const data = await resp.json(); | ||
// Check | ||
if (data.message) { | ||
return Promise.reject(new Error(data.message)); | ||
} | ||
else if (!Array.isArray(data)) { | ||
return Promise.reject(new Error('response was not an array of members')); | ||
} | ||
else if (data.length === 0) { | ||
return new Set(); | ||
} | ||
// Process | ||
return new Set(await Promise.all(data.map(async function (contributor) { | ||
const profile = await getMemberProfile(contributor.url, credentials); | ||
const fellow = fellow_1.default.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}); | ||
// @todo fellow.organizations.add(slug); | ||
return fellow; | ||
}))); | ||
// prepare | ||
const results = new Set(); | ||
// check | ||
if (data.message) | ||
throw new Error(data.message); | ||
if (!Array.isArray(data)) | ||
throw new Error('response was not an array of members'); | ||
if (data.length === 0) | ||
return results; | ||
// add these items | ||
const pool = new native_promise_pool_1.default(opts.concurrency); | ||
list_1.append(results, await Promise.all(data.map((contributor) => pool.open(() => getMember(contributor.url, credentials))))); | ||
// add next items | ||
const within = opts.pages === 0 || opts.page < opts.pages; | ||
const anotherPage = data.length === opts.size && within; | ||
if (anotherPage) | ||
list_1.append(results, await getMembersFromOrg(org, { | ||
...opts, | ||
page: opts.page + 1, | ||
}, credentials)); | ||
// return it all | ||
return results; | ||
} | ||
@@ -85,9 +113,9 @@ exports.getMembersFromOrg = getMembersFromOrg; | ||
* @param org the orgs to fetch the members for, e.g. `["bevry", "browserstate"]` | ||
* @param concurrency custom concurrency to use, defaults to `0` which is infinite | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
async function getMembersFromOrgs(orgs, concurrency = 0, credentials) { | ||
const pool = new native_promise_pool_1.default(concurrency); | ||
return fellow_1.default.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, credentials))))); | ||
async function getMembersFromOrgs(orgs, opts = {}, credentials) { | ||
const pool = new native_promise_pool_1.default(opts.concurrency); | ||
return fellow_1.default.flatten(await Promise.all(orgs.map((org) => pool.open(() => getMembersFromOrg(org, opts, credentials))))); | ||
} | ||
exports.getMembersFromOrgs = getMembersFromOrgs; |
# History | ||
## v5.1.0 2021 August 5 | ||
- Formalize `concurrency` within `MultiOpts` | ||
- Iterate/support pages on contributors | ||
## v5.0.0 2021 August 5 | ||
@@ -4,0 +9,0 @@ |
{ | ||
"title": "GitHub Members", | ||
"name": "@bevry/github-members", | ||
"version": "5.0.0", | ||
"version": "5.1.0-next.1628133868.595aa85b7f826f1e6b8262c315e5ae9577faf443", | ||
"description": "Fetch all the members of all the specified github organizations with their complete details", | ||
@@ -152,2 +152,3 @@ "homepage": "https://github.com/bevry/getmembers", | ||
"@bevry/github-api": "^9.0.0", | ||
"@bevry/list": "^1.7.0", | ||
"fellow": "^6.24.0", | ||
@@ -223,2 +224,2 @@ "native-promise-pool": "^3.19.0", | ||
} | ||
} | ||
} |
@@ -61,3 +61,3 @@ <!-- TITLE/ --> | ||
<script type="module"> | ||
import * as pkg from '//cdn.skypack.dev/@bevry/github-members@^5.0.0' | ||
import * as pkg from '//cdn.skypack.dev/@bevry/github-members@^5.1.0' | ||
</script> | ||
@@ -70,3 +70,3 @@ ``` | ||
<script type="module"> | ||
import * as pkg from '//unpkg.com/@bevry/github-members@^5.0.0' | ||
import * as pkg from '//unpkg.com/@bevry/github-members@^5.1.0' | ||
</script> | ||
@@ -79,3 +79,3 @@ ``` | ||
<script type="module"> | ||
import * as pkg from '//dev.jspm.io/@bevry/github-members@5.0.0' | ||
import * as pkg from '//dev.jspm.io/@bevry/github-members@5.1.0' | ||
</script> | ||
@@ -82,0 +82,0 @@ ``` |
@@ -8,3 +8,19 @@ /* eslint camelcase:0 */ | ||
import { query, GitHubCredentials } from '@bevry/github-api' | ||
import { append } from '@bevry/list' | ||
/** Options for queries that return multiple results. */ | ||
export interface MultiOptions { | ||
/** If you wish to skip the first page, then set this param, defaults to 1 */ | ||
page?: number | ||
/** If you wish to change the amount of items returned per page, then set this param */ | ||
size?: number | ||
/** If you wish to fetch unlimited pages, set this to zero, if you wish to fetch a specific amount of pages, then set this accordingly, defaults to `10` */ | ||
pages?: number | ||
/** How many requests to make at once, defaults to `0` which is unlimited. */ | ||
concurrency?: number | ||
} | ||
/** Collection of fellows */ | ||
@@ -89,3 +105,3 @@ export type Fellows = Set<Fellow> | ||
/** | ||
* Fetch the full profile information for a member | ||
* Fetch the full profile information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
@@ -115,4 +131,31 @@ * @param credentials custom github credentials, omit to use the environment variables | ||
/** | ||
* Fetch members from a GitHub organization | ||
* Fetch the parsed information for a member. | ||
* @param url the complete API url to fetch the details for the member | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
*/ | ||
export async function getMember( | ||
url: string, | ||
credentials?: GitHubCredentials | ||
): Promise<Fellow> { | ||
const profile = await getMemberProfile(url, credentials) | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}) | ||
// @todo fellow.organizations.add(slug); | ||
return fellow | ||
} | ||
/** | ||
* Fetch members from a GitHub organization. | ||
* @param org the org to fetch the members for, e.g. `"bevry"` | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
@@ -122,9 +165,17 @@ */ | ||
org: string, | ||
opts: MultiOptions = {}, | ||
credentials?: GitHubCredentials | ||
): Promise<Fellows> { | ||
// Fetch | ||
// defaults | ||
if (opts.page == null) opts.page = 1 | ||
if (opts.pages == null) opts.pages = 10 | ||
if (opts.size == null) opts.size = 100 | ||
// fetch | ||
// https://docs.github.com/en/rest/reference/orgs#list-public-organization-members | ||
const resp = await query({ | ||
pathname: `orgs/${org}/public_members`, | ||
searchParams: { | ||
per_page: '100', | ||
page: String(opts.page), | ||
per_page: String(opts.size), | ||
}, | ||
@@ -136,33 +187,40 @@ userAgent: '@bevry/github-members', | ||
// Check | ||
if (data.message) { | ||
return Promise.reject(new Error(data.message)) | ||
} else if (!Array.isArray(data)) { | ||
return Promise.reject(new Error('response was not an array of members')) | ||
} else if (data.length === 0) { | ||
return new Set<Fellow>() | ||
} | ||
// prepare | ||
const results: Fellows = new Set<Fellow>() | ||
// Process | ||
return new Set<Fellow>( | ||
// check | ||
if (data.message) throw new Error(data.message) | ||
if (!Array.isArray(data)) | ||
throw new Error('response was not an array of members') | ||
if (data.length === 0) return results | ||
// add these items | ||
const pool = new Pool(opts.concurrency) | ||
append( | ||
results, | ||
await Promise.all( | ||
data.map(async function (contributor) { | ||
const profile = await getMemberProfile(contributor.url, credentials) | ||
const fellow = Fellow.ensure({ | ||
githubProfile: profile, | ||
name: profile.name, | ||
email: profile.email, | ||
description: profile.bio, | ||
company: profile.company, | ||
location: profile.location, | ||
homepage: profile.blog, | ||
hireable: profile.hireable, | ||
githubUsername: profile.login, | ||
githubUrl: profile.html_url, | ||
}) | ||
// @todo fellow.organizations.add(slug); | ||
return fellow | ||
}) | ||
data.map((contributor) => | ||
pool.open(() => getMember(contributor.url, credentials)) | ||
) | ||
) | ||
) | ||
// add next items | ||
const within = opts.pages === 0 || opts.page < opts.pages | ||
const anotherPage = data.length === opts.size && within | ||
if (anotherPage) | ||
append( | ||
results, | ||
await getMembersFromOrg( | ||
org, | ||
{ | ||
...opts, | ||
page: opts.page + 1, | ||
}, | ||
credentials | ||
) | ||
) | ||
// return it all | ||
return results | ||
} | ||
@@ -173,3 +231,3 @@ | ||
* @param org the orgs to fetch the members for, e.g. `["bevry", "browserstate"]` | ||
* @param concurrency custom concurrency to use, defaults to `0` which is infinite | ||
* @param opts custom search options | ||
* @param credentials custom github credentials, omit to use the environment variables | ||
@@ -179,11 +237,13 @@ */ | ||
orgs: Array<string>, | ||
concurrency: number = 0, | ||
opts: MultiOptions = {}, | ||
credentials?: GitHubCredentials | ||
): Promise<Fellows> { | ||
const pool = new Pool(concurrency) | ||
const pool = new Pool(opts.concurrency) | ||
return Fellow.flatten( | ||
await Promise.all( | ||
orgs.map((org) => pool.open(() => getMembersFromOrg(org, credentials))) | ||
orgs.map((org) => | ||
pool.open(() => getMembersFromOrg(org, opts, credentials)) | ||
) | ||
) | ||
) | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51613
674
5
1
+ Added@bevry/list@^1.7.0
+ Added@bevry/list@1.8.0(transitive)