Provides a NPM module that transforms data from typhonjs-github-inspect-orgs to normalized HTML, markdown, JSON or text.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.babelrc
.esdocrc
.eslintignore
.eslintrc
.gitignore
.npmscriptrc
.travis.yml
AUTHORS.md
CHANGELOG.md
LICENSE
README.md
gulpfile.babel.js
package.json

README.md

typhonjs-github-inspect-orgs-transform

NPM Code Style License Gitter

Build Status Coverage Dependency Status

Provides a NPM module that transforms data from GitHubInspectOrgs / typhonjs-github-inspect-orgs to normalized HTML, markdown, JSON or text by piping to console or a provided function along with returning the output of GitHubInspectOrgs in addition to the transformed data via Promises. The API mirrors typhonjs-github-inspect-orgs and requires an instance of GitHubInspectOrgs injected into the constructor of GitHubInspectOrgsTransform. GitHubInspectOrgsTransform excels at creating indexes in several popular formats for a many-organization / repo effort such as TyphonJS and beyond.

By default the following transform types are available: html, json, markdown and text and initially set in an options hash with an optional transformType entry passed into the constructor as the second parameter. All methods transform normalized output data from a GitHubInspectOrgs query as a string, but user supplied transforms may output any type of data.

To configure GitHubInspectOrgsTransform first create an instance of GitHubInspectOrgs:

import GitHubInspectOrgs          from 'typhonjs-github-inspect-orgs';
import GitHubInspectOrgsTransform from 'typhonjs-github-inspect-orgs-transform';

const githubInspect = new GitHubInspectOrgs(
{
    organizations: [{ credential: <GITHUB PUBLIC TOKEN>, owner: <GITHUB USER NAME OWNING ORGANIZATIONS>,
                    regex: '^typhonjs' }],
});

const inspectTransform = new GitHubInspectOrgsTransform(githubInspect);

Additional optional parameters to configure GitHubInspectOrgsTransform include:

(string)    transformType - The current transform type; default ('text').

(object)    transforms - A hash with user supplied transforms to add to TransformControl.

While creating custom transforms is not discussed in detail please review the current implementations in ./src/transform for guidance.

Each method of GitHubInspectOrgsTransform forwards on any options also supported by typhonjs-github-inspect-orgs. In addition GitHubInspectOrgsTransform may also take optional parameters. In particular a pipeFunction function entry is invoked immediately with the resulting transformed data. The transformed results are added to the original data returned by a given query with a new key transformed and returned as a Promise.

Most methods take a hash of optional parameters. The four optional parameters that are supported include:

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

Please review ./test/fixture for examples of transformed output used in testing. These examples are generated from typhonjs-test organizations.


GitHubInspectOrgsTransform method summary:

  • getCollaborators - Transforms all collaborators across all organizations.
  • getContributors - Transforms all contributors across all organizations.
  • getMembers - Transforms all organization members across all organizations.
  • getOrgMembers - Transforms all members by organization across all organizations.
  • getOrgRepos - Transforms all repos by organization across all organizations.
  • getOrgRepoCollaborators - Transforms all collaborators by repo by organization across all organizations.
  • getOrgRepoContributors - Transforms all contributors by repo by organization across all organizations.
  • getOrgRepoStats - Transforms GitHub statistics by repo by organization across all organizations.
  • getOrgs - Transforms all organizations.
  • getOrgTeams - Transforms all teams by organization across all organizations.
  • getOrgTeamMembers - Transforms all members by team by organization across all organizations.
  • getOwnerOrgs - Transforms all organizations by organization owner.
  • getOwnerRateLimits - Transforms the current rate limits for all organization owners.
  • getOwners - Transforms all organization owners.
  • getUserFromCredential - Transforms the GitHub user who owns the provided credential.

####getCollaborators

Transforms all normalized data from GitHubInspectOrgs->getCollaborators returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getContributors

Transforms all normalized data from GitHubInspectOrgs->getContributors returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getMembers

Transforms all normalized data from GitHubInspectOrgs->getMembers returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgMembers

Transforms all normalized data from GitHubInspectOrgs->getOrgMembers returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgRepos

Transforms all normalized data from GitHubInspectOrgs->getOrgRepos returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgRepoCollaborators

Transforms all normalized data from GitHubInspectOrgs->getOrgRepoCollaborators returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgRepoContributors

Transforms all normalized data from GitHubInspectOrgs->getOrgRepoContributors returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgRepoStats

Transforms all normalized data from GitHubInspectOrgs->getOrgRepoStats returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgs

Transforms all normalized data from GitHubInspectOrgs->getOrgs returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgTeams

Transforms all normalized data from GitHubInspectOrgs->getOrgTeams returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOrgTeamMembers

Transforms all normalized data from GitHubInspectOrgs->getOrgTeamMembers returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOwnerOrgs

Transforms all normalized data from GitHubInspectOrgs->getOwnerOrgs returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOwnerRateLimits

Transforms all normalized data from GitHubInspectOrgs->getOwnerRateLimits returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getOwners

Transforms all normalized data from GitHubInspectOrgs->getOwners returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.


####getUserFromCredential

Transforms all normalized data from GitHubInspectOrgs->getUserFromCredential returning the original query data including the transformed results under an added key transformed. In addition if an optional function, pipeFunction, is supplied it is invoked immediately with the transformed results.

@param {object} options - Optional parameters.

(string)    credential - A public access token with `public_repo` and `read:org` permissions for any GitHub
                         user which limits the responses to the organizations and other query data that this
                         particular user is a member of or has access to currently.

(boolean)   description - Add additional description info for all entries where available; default (false).

(function)  pipeFunction - A function that will be invoked with a single parameter with the transformed result.

(string)    transformType - Overrides current TransformControl transform type.

For additional GitHubInspectOrgs options see:

Please see the various permutations from tests for the transformed data requested for example output:

Returns Promise with an object hash containing normalized, raw and transformed entries.