Add node modules and package files

This commit is contained in:
Rachael Sewell 2019-09-06 15:17:38 -07:00
parent e84489cd02
commit 714607abe9
165 changed files with 2227 additions and 4644 deletions

1
node_modules/.bin/semver generated vendored Symbolic link
View File

@ -0,0 +1 @@
../semver/bin/semver

1
node_modules/.bin/which generated vendored Symbolic link
View File

@ -0,0 +1 @@
../which/bin/which

7
node_modules/@actions/core/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,7 @@
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

104
node_modules/@actions/core/README.md generated vendored
View File

@ -1,7 +1,97 @@
# `@actions/core`
> Core functions for setting results, logging, registering secrets and exporting variables across actions
## Usage
See [src/core.ts](src/core.ts).
# `@actions/core`
> Core functions for setting results, logging, registering secrets and exporting variables across actions
## Usage
#### Inputs/Outputs
You can use this library to get inputs or set outputs:
```js
const core = require('@actions/core');
const myInput = core.getInput('inputName', { required: true });
// Do stuff
core.setOutput('outputKey', 'outputVal');
```
#### Exporting variables
You can also export variables for future steps. Variables get set in the environment.
```js
const core = require('@actions/core');
// Do stuff
core.exportVariable('envVar', 'Val');
```
#### PATH Manipulation
You can explicitly add items to the path for all remaining steps in a workflow:
```js
const core = require('@actions/core');
core.addPath('pathToTool');
```
#### Exit codes
You should use this library to set the failing exit code for your action:
```js
const core = require('@actions/core');
try {
// Do stuff
}
catch (err) {
// setFailed logs the message and sets a failing exit code
core.setFailed(`Action failed with error ${err}`);
}
```
#### Logging
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
```js
const core = require('@actions/core');
const myInput = core.getInput('input');
try {
core.debug('Inside try block');
if (!myInput) {
core.warning('myInput was not set');
}
// Do stuff
}
catch (err) {
core.error(`Error ${err}, action may still succeed though`);
}
```
This library can also wrap chunks of output in foldable groups.
```js
const core = require('@actions/core')
// Manually wrap output
core.startGroup('Do some function')
doSomeFunction()
core.endGroup()
// Wrap an asynchronous function call
const result = await core.group('Do something async', async () => {
const response = await doSomeHTTPRequest()
return response
})
```

View File

@ -1,16 +1,16 @@
interface CommandProperties {
[key: string]: string;
}
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message: string): void;
export {};
interface CommandProperties {
[key: string]: string;
}
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definitelyNotAPassword!
*/
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
export declare function issue(name: string, message?: string): void;
export {};

View File

@ -1,66 +1,66 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os");
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definatelyNotAPassword!
*/
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL);
}
exports.issueCommand = issueCommand;
function issue(name, message) {
issueCommand(name, {}, message);
}
exports.issue = issue;
const CMD_PREFIX = '##[';
class Command {
constructor(command, properties, message) {
if (!command) {
command = 'missing.command';
}
this.command = command;
this.properties = properties;
this.message = message;
}
toString() {
let cmdStr = CMD_PREFIX + this.command;
if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' ';
for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key];
if (val) {
// safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)};`;
}
}
}
}
cmdStr += ']';
// safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
const message = `${this.message || ''}`;
cmdStr += escapeData(message);
return cmdStr;
}
}
function escapeData(s) {
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
}
function escape(s) {
return s
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
.replace(/]/g, '%5D')
.replace(/;/g, '%3B');
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const os = require("os");
/**
* Commands
*
* Command Format:
* ##[name key=value;key=value]message
*
* Examples:
* ##[warning]This is the user warning message
* ##[set-secret name=mypassword]definitelyNotAPassword!
*/
function issueCommand(command, properties, message) {
const cmd = new Command(command, properties, message);
process.stdout.write(cmd.toString() + os.EOL);
}
exports.issueCommand = issueCommand;
function issue(name, message = '') {
issueCommand(name, {}, message);
}
exports.issue = issue;
const CMD_PREFIX = '##[';
class Command {
constructor(command, properties, message) {
if (!command) {
command = 'missing.command';
}
this.command = command;
this.properties = properties;
this.message = message;
}
toString() {
let cmdStr = CMD_PREFIX + this.command;
if (this.properties && Object.keys(this.properties).length > 0) {
cmdStr += ' ';
for (const key in this.properties) {
if (this.properties.hasOwnProperty(key)) {
const val = this.properties[key];
if (val) {
// safely append the val - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
cmdStr += `${key}=${escape(`${val || ''}`)};`;
}
}
}
}
cmdStr += ']';
// safely append the message - avoid blowing up when attempting to
// call .replace() if message is not a string for some reason
const message = `${this.message || ''}`;
cmdStr += escapeData(message);
return cmdStr;
}
}
function escapeData(s) {
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
}
function escape(s) {
return s
.replace(/\r/g, '%0D')
.replace(/\n/g, '%0A')
.replace(/]/g, '%5D')
.replace(/;/g, '%3B');
}
//# sourceMappingURL=command.js.map

View File

@ -1 +1 @@
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,OAAe;IACjD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,8DAA8D;wBAC9D,6DAA6D;wBAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAA;qBAC9C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,CAAA;QAEb,kEAAkE;QAClE,6DAA6D;QAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,8DAA8D;wBAC9D,6DAA6D;wBAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAA;qBAC9C;iBACF;aACF;SACF;QAED,MAAM,IAAI,GAAG,CAAA;QAEb,kEAAkE;QAClE,6DAA6D;QAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}

View File

@ -1,81 +1,94 @@
/**
* Interface for getInput options
*/
export interface InputOptions {
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
required?: boolean;
}
/**
* The code to exit an action
*/
export declare enum ExitCode {
/**
* A code indicating that the action was successful
*/
Success = 0,
/**
* A code indicating that the action was a failure
*/
Failure = 1,
/**
* A code indicating that the action is complete, but neither succeeded nor failed
*/
Neutral = 78
}
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
export declare function exportVariable(name: string, val: string): void;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
export declare function exportSecret(name: string, val: string): void;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
export declare function addPath(inputPath: string): void;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
export declare function getInput(name: string, options?: InputOptions): string;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
export declare function setOutput(name: string, value: string): void;
/**
* Sets the action status to neutral
*/
export declare function setNeutral(): void;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
export declare function setFailed(message: string): void;
/**
* Writes debug message to user log
* @param message debug message
*/
export declare function debug(message: string): void;
/**
* Adds an error issue
* @param message error issue message
*/
export declare function error(message: string): void;
/**
* Adds an warning issue
* @param message warning issue message
*/
export declare function warning(message: string): void;
/**
* Interface for getInput options
*/
export interface InputOptions {
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
required?: boolean;
}
/**
* The code to exit an action
*/
export declare enum ExitCode {
/**
* A code indicating that the action was successful
*/
Success = 0,
/**
* A code indicating that the action was a failure
*/
Failure = 1
}
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
export declare function exportVariable(name: string, val: string): void;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
export declare function exportSecret(name: string, val: string): void;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
export declare function addPath(inputPath: string): void;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
export declare function getInput(name: string, options?: InputOptions): string;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
export declare function setOutput(name: string, value: string): void;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
export declare function setFailed(message: string): void;
/**
* Writes debug message to user log
* @param message debug message
*/
export declare function debug(message: string): void;
/**
* Adds an error issue
* @param message error issue message
*/
export declare function error(message: string): void;
/**
* Adds an warning issue
* @param message warning issue message
*/
export declare function warning(message: string): void;
/**
* Begin an output group.
*
* Output until the next `groupEnd` will be foldable in this group
*
* @param name The name of the output group
*/
export declare function startGroup(name: string): void;
/**
* End an output group.
*/
export declare function endGroup(): void;
/**
* Wrap an asynchronous function call in a group.
*
* Returns the same type as the function itself.
*
* @param name The name of the group
* @param fn The function to wrap in the group
*/
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;

View File

@ -1,127 +1,168 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command");
const path = require("path");
/**
* The code to exit an action
*/
var ExitCode;
(function (ExitCode) {
/**
* A code indicating that the action was successful
*/
ExitCode[ExitCode["Success"] = 0] = "Success";
/**
* A code indicating that the action was a failure
*/
ExitCode[ExitCode["Failure"] = 1] = "Failure";
/**
* A code indicating that the action is complete, but neither succeeded nor failed
*/
ExitCode[ExitCode["Neutral"] = 78] = "Neutral";
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
//-----------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
function exportVariable(name, val) {
process.env[name] = val;
command_1.issueCommand('set-env', { name }, val);
}
exports.exportVariable = exportVariable;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
function exportSecret(name, val) {
exportVariable(name, val);
command_1.issueCommand('set-secret', {}, val);
}
exports.exportSecret = exportSecret;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
function addPath(inputPath) {
command_1.issueCommand('add-path', {}, inputPath);
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
exports.addPath = addPath;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`);
}
return val.trim();
}
exports.getInput = getInput;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
function setOutput(name, value) {
command_1.issueCommand('set-output', { name }, value);
}
exports.setOutput = setOutput;
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/**
* Sets the action status to neutral
*/
function setNeutral() {
process.exitCode = ExitCode.Neutral;
}
exports.setNeutral = setNeutral;
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
function setFailed(message) {
process.exitCode = ExitCode.Failure;
error(message);
}
exports.setFailed = setFailed;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/**
* Writes debug message to user log
* @param message debug message
*/
function debug(message) {
command_1.issueCommand('debug', {}, message);
}
exports.debug = debug;
/**
* Adds an error issue
* @param message error issue message
*/
function error(message) {
command_1.issue('error', message);
}
exports.error = error;
/**
* Adds an warning issue
* @param message warning issue message
*/
function warning(message) {
command_1.issue('warning', message);
}
exports.warning = warning;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const command_1 = require("./command");
const path = require("path");
/**
* The code to exit an action
*/
var ExitCode;
(function (ExitCode) {
/**
* A code indicating that the action was successful
*/
ExitCode[ExitCode["Success"] = 0] = "Success";
/**
* A code indicating that the action was a failure
*/
ExitCode[ExitCode["Failure"] = 1] = "Failure";
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
//-----------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------
/**
* sets env variable for this action and future actions in the job
* @param name the name of the variable to set
* @param val the value of the variable
*/
function exportVariable(name, val) {
process.env[name] = val;
command_1.issueCommand('set-env', { name }, val);
}
exports.exportVariable = exportVariable;
/**
* exports the variable and registers a secret which will get masked from logs
* @param name the name of the variable to set
* @param val value of the secret
*/
function exportSecret(name, val) {
exportVariable(name, val);
// the runner will error with not implemented
// leaving the function but raising the error earlier
command_1.issueCommand('set-secret', {}, val);
throw new Error('Not implemented.');
}
exports.exportSecret = exportSecret;
/**
* Prepends inputPath to the PATH (for this action and future actions)
* @param inputPath
*/
function addPath(inputPath) {
command_1.issueCommand('add-path', {}, inputPath);
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
}
exports.addPath = addPath;
/**
* Gets the value of an input. The value is also trimmed.
*
* @param name name of the input to get
* @param options optional. See InputOptions.
* @returns string
*/
function getInput(name, options) {
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
if (options && options.required && !val) {
throw new Error(`Input required and not supplied: ${name}`);
}
return val.trim();
}
exports.getInput = getInput;
/**
* Sets the value of an output.
*
* @param name name of the output to set
* @param value value to store
*/
function setOutput(name, value) {
command_1.issueCommand('set-output', { name }, value);
}
exports.setOutput = setOutput;
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/**
* Sets the action status to failed.
* When the action exits it will be with an exit code of 1
* @param message add error issue message
*/
function setFailed(message) {
process.exitCode = ExitCode.Failure;
error(message);
}
exports.setFailed = setFailed;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
/**
* Writes debug message to user log
* @param message debug message
*/
function debug(message) {
command_1.issueCommand('debug', {}, message);
}
exports.debug = debug;
/**
* Adds an error issue
* @param message error issue message
*/
function error(message) {
command_1.issue('error', message);
}
exports.error = error;
/**
* Adds an warning issue
* @param message warning issue message
*/
function warning(message) {
command_1.issue('warning', message);
}
exports.warning = warning;
/**
* Begin an output group.
*
* Output until the next `groupEnd` will be foldable in this group
*
* @param name The name of the output group
*/
function startGroup(name) {
command_1.issue('group', name);
}
exports.startGroup = startGroup;
/**
* End an output group.
*/
function endGroup() {
command_1.issue('endgroup');
}
exports.endGroup = endGroup;
/**
* Wrap an asynchronous function call in a group.
*
* Returns the same type as the function itself.
*
* @param name The name of the group
* @param fn The function to wrap in the group
*/
function group(name, fn) {
return __awaiter(this, void 0, void 0, function* () {
startGroup(name);
let result;
try {
result = yield fn();
}
finally {
endGroup();
}
return result;
});
}
exports.group = group;
//# sourceMappingURL=core.js.map

View File

@ -1 +1 @@
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,8CAAY,CAAA;AACd,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACzB,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;AACrC,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;GAEG;AACH,SAAgB,UAAU;IACxB,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;AACrC,CAAC;AAFD,gCAEC;AAED;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC"}
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEzB,6CAA6C;IAC7C,qDAAqD;IACrD,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;AACrC,CAAC;AAPD,oCAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACpE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC"}

View File

@ -1,35 +1,34 @@
{
"_args": [
[
"@actions/core@file:toolkit/actions-core-0.0.0.tgz",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
"_id": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
"_from": "@actions/core",
"_id": "@actions/core@1.1.0",
"_inBundle": false,
"_integrity": "sha512-P+mC79gXC2yvyU0+RDctxKUI1Q3tNruB+aSmFI47j2H0DylxtDEgycW9WXwt/zCY62lfwfvBoGKpuJRvFHDqpw==",
"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA==",
"_location": "/@actions/core",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"raw": "@actions/core@file:toolkit/actions-core-0.0.0.tgz",
"type": "tag",
"registry": true,
"raw": "@actions/core",
"name": "@actions/core",
"escapedName": "@actions%2fcore",
"scope": "@actions",
"rawSpec": "file:toolkit/actions-core-0.0.0.tgz",
"saveSpec": "file:toolkit/actions-core-0.0.0.tgz",
"fetchSpec": "/Users/rachmari/github-repos/hello-world-javascript-action/toolkit/actions-core-0.0.0.tgz"
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_spec": "file:toolkit/actions-core-0.0.0.tgz",
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz",
"_shasum": "25c3aff43a20f9c5a04e2a3439898a49ba8d3625",
"_spec": "@actions/core",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Actions core lib",
"devDependencies": {
"@types/node": "^12.0.2"
@ -41,10 +40,12 @@
"files": [
"lib"
],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
"keywords": [
"core",
"actions"
"github",
"actions",
"core"
],
"license": "MIT",
"main": "lib/core.js",
@ -60,5 +61,5 @@
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.1.0"
}

7
node_modules/@actions/github/LICENSE.md generated vendored Normal file
View File

@ -0,0 +1,7 @@
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,47 +1,50 @@
# `@actions/github`
> A hydrated Octokit client.
## Usage
Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the API.
```
const github = require('@actions/github');
// This should be a token with access to your repository scoped in as a secret.
const myToken = process.env.GITHUB_TOKEN
const octokit = new github.GitHub(myToken)
const pulls = await octokit.pulls.get({
owner: 'octokit',
repo: 'rest.js',
pull_number: 123,
mediaType: {
format: 'diff'
}
})
console.log(pulls)
```
You can also make GraphQL requests:
```
const result = await octokit.graphql(query, variables)
```
Finally, you can get the context of the current action:
```
const github = require('@actions/github');
const context = github.context
const newIssue = await octokit.issues.create({
...context.repo,
title: 'New issue!',
body: 'Hello Universe!'
})
```
# `@actions/github`
> A hydrated Octokit client.
## Usage
Returns an Octokit client. See https://octokit.github.io/rest.js for the API.
```js
const github = require('@actions/github');
const core = require('@actions/core');
// This should be a token with access to your repository scoped in as a secret.
const myToken = core.getInput('myToken');
const octokit = new github.GitHub(myToken);
const { data: pullRequest } = await octokit.pulls.get({
owner: 'octokit',
repo: 'rest.js',
pull_number: 123,
mediaType: {
format: 'diff'
}
});
console.log(pullRequest);
```
You can pass client options (except `auth`, which is handled by the token argument), as specified by [Octokit](https://octokit.github.io/rest.js/), as a second argument to the `GitHub` constructor.
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
```js
const result = await octokit.graphql(query, variables);
```
Finally, you can get the context of the current action:
```js
const github = require('@actions/github');
const context = github.context;
const newIssue = await octokit.issues.create({
...context.repo,
title: 'New issue!',
body: 'Hello Universe!'
});
```

View File

@ -1,26 +1,26 @@
import { WebhookPayload } from './interfaces';
export declare class Context {
/**
* Webhook payload object that triggered the workflow
*/
payload: WebhookPayload;
eventName: string;
sha: string;
ref: string;
workflow: string;
action: string;
actor: string;
/**
* Hydrate the context from the environment
*/
constructor();
readonly issue: {
owner: string;
repo: string;
number: number;
};
readonly repo: {
owner: string;
repo: string;
};
}
import { WebhookPayload } from './interfaces';
export declare class Context {
/**
* Webhook payload object that triggered the workflow
*/
payload: WebhookPayload;
eventName: string;
sha: string;
ref: string;
workflow: string;
action: string;
actor: string;
/**
* Hydrate the context from the environment
*/
constructor();
readonly issue: {
owner: string;
repo: string;
number: number;
};
readonly repo: {
owner: string;
repo: string;
};
}

View File

@ -1,38 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/* eslint-disable @typescript-eslint/no-require-imports */
class Context {
/**
* Hydrate the context from the environment
*/
constructor() {
this.payload = process.env.GITHUB_EVENT_PATH
? require(process.env.GITHUB_EVENT_PATH)
: {};
this.eventName = process.env.GITHUB_EVENT_NAME;
this.sha = process.env.GITHUB_SHA;
this.ref = process.env.GITHUB_REF;
this.workflow = process.env.GITHUB_WORKFLOW;
this.action = process.env.GITHUB_ACTION;
this.actor = process.env.GITHUB_ACTOR;
}
get issue() {
const payload = this.payload;
return Object.assign({}, this.repo, { number: (payload.issue || payload.pullRequest || payload).number });
}
get repo() {
if (process.env.GITHUB_REPOSITORY) {
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
return { owner, repo };
}
if (this.payload.repository) {
return {
owner: this.payload.repository.owner.login,
repo: this.payload.repository.name
};
}
throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
}
}
exports.Context = Context;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = require("fs");
const os_1 = require("os");
class Context {
/**
* Hydrate the context from the environment
*/
constructor() {
this.payload = {};
if (process.env.GITHUB_EVENT_PATH) {
if (fs_1.existsSync(process.env.GITHUB_EVENT_PATH)) {
this.payload = JSON.parse(fs_1.readFileSync(process.env.GITHUB_EVENT_PATH, { encoding: 'utf8' }));
}
else {
process.stdout.write(`GITHUB_EVENT_PATH ${process.env.GITHUB_EVENT_PATH} does not exist${os_1.EOL}`);
}
}
this.eventName = process.env.GITHUB_EVENT_NAME;
this.sha = process.env.GITHUB_SHA;
this.ref = process.env.GITHUB_REF;
this.workflow = process.env.GITHUB_WORKFLOW;
this.action = process.env.GITHUB_ACTION;
this.actor = process.env.GITHUB_ACTOR;
}
get issue() {
const payload = this.payload;
return Object.assign(Object.assign({}, this.repo), { number: (payload.issue || payload.pullRequest || payload).number });
}
get repo() {
if (process.env.GITHUB_REPOSITORY) {
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
return { owner, repo };
}
if (this.payload.repository) {
return {
owner: this.payload.repository.owner.login,
repo: this.payload.repository.name
};
}
throw new Error("context.repo requires a GITHUB_REPOSITORY environment variable like 'owner/repo'");
}
}
exports.Context = Context;
//# sourceMappingURL=context.js.map

View File

@ -1 +1 @@
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAGA,0DAA0D;AAE1D,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB;YAC1C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;YACxC,CAAC,CAAC,EAAE,CAAA;QACN,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;IACjD,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,yBACK,IAAI,CAAC,IAAI,IACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC,MAAM,IACjE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AAtDD,0BAsDC"}
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;AAEA,2BAA2C;AAC3C,2BAAsB;AAEtB,MAAa,OAAO;IAalB;;OAEG;IACH;QACE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,IAAI,eAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE;gBAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CACvB,iBAAY,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAC,CAChE,CAAA;aACF;iBAAM;gBACL,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,qBACE,OAAO,CAAC,GAAG,CAAC,iBACd,kBAAkB,QAAG,EAAE,CACxB,CAAA;aACF;SACF;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,iBAA2B,CAAA;QACxD,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,UAAoB,CAAA;QAC3C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAyB,CAAA;QACrD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAuB,CAAA;QACjD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,YAAsB,CAAA;IACjD,CAAC;IAED,IAAI,KAAK;QACP,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAE5B,uCACK,IAAI,CAAC,IAAI,KACZ,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,CAAC,MAAM,IACjE;IACH,CAAC;IAED,IAAI,IAAI;QACN,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE;YACjC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC9D,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,CAAA;SACrB;QAED,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC3B,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK;gBAC1C,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI;aACnC,CAAA;SACF;QAED,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;IACH,CAAC;CACF;AAjED,0BAiEC"}

View File

@ -1,6 +1,8 @@
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
import Octokit from '@octokit/rest';
export declare class GitHub extends Octokit {
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
constructor(token: string);
}
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
import Octokit from '@octokit/rest';
import * as Context from './context';
export declare const context: Context.Context;
export declare class GitHub extends Octokit {
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
constructor(token: string, opts?: Omit<Octokit.Options, 'auth'>);
}

View File

@ -1,29 +1,29 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
const graphql_1 = require("@octokit/graphql");
const rest_1 = __importDefault(require("@octokit/rest"));
const Context = __importStar(require("./context"));
// We need this in order to extend Octokit
rest_1.default.prototype = new rest_1.default();
module.exports.context = new Context.Context();
class GitHub extends rest_1.default {
constructor(token) {
super({ auth: `token ${token}` });
this.graphql = graphql_1.defaults({
headers: { authorization: `token ${token}` }
});
}
}
exports.GitHub = GitHub;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts
const graphql_1 = require("@octokit/graphql");
const rest_1 = __importDefault(require("@octokit/rest"));
const Context = __importStar(require("./context"));
// We need this in order to extend Octokit
rest_1.default.prototype = new rest_1.default();
exports.context = new Context.Context();
class GitHub extends rest_1.default {
constructor(token, opts = {}) {
super(Object.assign(Object.assign({}, opts), { auth: `token ${token}` }));
this.graphql = graphql_1.defaults({
headers: { authorization: `token ${token}` }
});
}
}
exports.GitHub = GitHub;
//# sourceMappingURL=github.js.map

View File

@ -1 +1 @@
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE9C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa,EAAE,OAAsC,EAAE;QACjE,KAAK,iCAAK,IAAI,KAAE,IAAI,EAAE,SAAS,KAAK,EAAE,IAAE,CAAA;QACxC,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}

View File

@ -1,36 +1,36 @@
export interface PayloadRepository {
[key: string]: any;
fullName?: string;
name: string;
owner: {
[key: string]: any;
login: string;
name?: string;
};
htmlUrl?: string;
}
export interface WebhookPayload {
[key: string]: any;
repository?: PayloadRepository;
issue?: {
[key: string]: any;
number: number;
html_url?: string;
body?: string;
};
pullRequest?: {
[key: string]: any;
number: number;
htmlUrl?: string;
body?: string;
};
sender?: {
[key: string]: any;
type: string;
};
action?: string;
installation?: {
id: number;
[key: string]: any;
};
}
export interface PayloadRepository {
[key: string]: any;
full_name?: string;
name: string;
owner: {
[key: string]: any;
login: string;
name?: string;
};
html_url?: string;
}
export interface WebhookPayload {
[key: string]: any;
repository?: PayloadRepository;
issue?: {
[key: string]: any;
number: number;
html_url?: string;
body?: string;
};
pull_request?: {
[key: string]: any;
number: number;
html_url?: string;
body?: string;
};
sender?: {
[key: string]: any;
type: string;
};
action?: string;
installation?: {
id: number;
[key: string]: any;
};
}

View File

@ -1,4 +1,4 @@
"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
"use strict";
/* eslint-disable @typescript-eslint/no-explicit-any */
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=interfaces.js.map

View File

@ -1,39 +1,38 @@
{
"_args": [
[
"@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"_id": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"_from": "@actions/github",
"_id": "@actions/github@1.1.0",
"_inBundle": false,
"_integrity": "sha512-K13pi9kbZqFnvhe8m6uqfz4kCnB4Ki6fzv4XBae1zDZfn2Si+Qx6j1pAfXSo7QI2+ZWAX/g0paFgcJsS6ZTWZA==",
"_integrity": "sha512-cHf6PyoNMdei13jEdGPhKprIMFmjVVW/dnM5/9QmQDJ1ZTaGVyezUSCUIC/ySNLRvDUpeFwPYMdThSEJldSbUw==",
"_location": "/@actions/github",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"raw": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"type": "tag",
"registry": true,
"raw": "@actions/github",
"name": "@actions/github",
"escapedName": "@actions%2fgithub",
"scope": "@actions",
"rawSpec": "file:toolkit/actions-github-0.0.0.tgz",
"saveSpec": "file:toolkit/actions-github-0.0.0.tgz",
"fetchSpec": "/Users/rachmari/github-repos/hello-world-javascript-action/toolkit/actions-github-0.0.0.tgz"
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_spec": "file:toolkit/actions-github-0.0.0.tgz",
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-1.1.0.tgz",
"_shasum": "06f34e6b0cf07eb2b3641de3e680dbfae6bcd400",
"_spec": "@actions/github",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"bundleDependencies": false,
"dependencies": {
"@octokit/graphql": "^2.0.1",
"@octokit/rest": "^16.15.0"
},
"deprecated": false,
"description": "Actions github lib",
"devDependencies": {
"jest": "^24.7.1"
@ -45,6 +44,7 @@
"files": [
"lib"
],
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
"keywords": [
"github",
@ -65,5 +65,5 @@
"test": "jest",
"tsc": "tsc"
},
"version": "0.0.0"
"version": "1.1.0"
}

View File

@ -4,10 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var deepmerge = _interopDefault(require('deepmerge'));
var isPlainObject = _interopDefault(require('is-plain-object'));
var urlTemplate = _interopDefault(require('url-template'));
var getUserAgent = _interopDefault(require('universal-user-agent'));
var universalUserAgent = require('universal-user-agent');
function lowercaseKeys(object) {
if (!object) {
@ -20,6 +18,22 @@ function lowercaseKeys(object) {
}, {});
}
function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => {
if (isPlainObject(options[key])) {
if (!(key in defaults)) Object.assign(result, {
[key]: options[key]
});else result[key] = mergeDeep(defaults[key], options[key]);
} else {
Object.assign(result, {
[key]: options[key]
});
}
});
return result;
}
function merge(defaults, route, options) {
if (typeof route === "string") {
let [method, url] = route.split(" ");
@ -35,9 +49,7 @@ function merge(defaults, route, options) {
options.headers = lowercaseKeys(options.headers);
const mergedOptions = deepmerge.all([defaults, options].filter(Boolean), {
isMergeableObject: isPlainObject
}); // mediaType.previews arrays are merged, instead of overwritten
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);
@ -87,6 +99,173 @@ function omit(object, keysToOmit) {
}, {});
}
// Based on https://github.com/bramstein/url-template, licensed under BSD
// TODO: create separate package.
//
// Copyright (c) 2012-2014, Bram Stein
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* istanbul ignore file */
function encodeReserved(str) {
return str.split(/(%[0-9A-Fa-f]{2})/g).map(function (part) {
if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
}
return part;
}).join("");
}
function encodeUnreserved(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
});
}
function encodeValue(operator, value, key) {
value = operator === "+" || operator === "#" ? encodeReserved(value) : encodeUnreserved(value);
if (key) {
return encodeUnreserved(key) + "=" + value;
} else {
return value;
}
}
function isDefined(value) {
return value !== undefined && value !== null;
}
function isKeyOperator(operator) {
return operator === ";" || operator === "&" || operator === "?";
}
function getValues(context, operator, key, modifier) {
var value = context[key],
result = [];
if (isDefined(value) && value !== "") {
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
value = value.toString();
if (modifier && modifier !== "*") {
value = value.substring(0, parseInt(modifier, 10));
}
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
} else {
if (modifier === "*") {
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
});
} else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
result.push(encodeValue(operator, value[k], k));
}
});
}
} else {
const tmp = [];
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
tmp.push(encodeValue(operator, value));
});
} else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
tmp.push(encodeUnreserved(k));
tmp.push(encodeValue(operator, value[k].toString()));
}
});
}
if (isKeyOperator(operator)) {
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
} else if (tmp.length !== 0) {
result.push(tmp.join(","));
}
}
}
} else {
if (operator === ";") {
if (isDefined(value)) {
result.push(encodeUnreserved(key));
}
} else if (value === "" && (operator === "&" || operator === "?")) {
result.push(encodeUnreserved(key) + "=");
} else if (value === "") {
result.push("");
}
}
return result;
}
function parseUrl(template) {
return {
expand: expand.bind(null, template)
};
}
function expand(template, context) {
var operators = ["+", "#", ".", "/", ";", "?", "&"];
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
if (expression) {
let operator = "";
const values = [];
if (operators.indexOf(expression.charAt(0)) !== -1) {
operator = expression.charAt(0);
expression = expression.substr(1);
}
expression.split(/,/g).forEach(function (variable) {
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
});
if (operator && operator !== "+") {
var separator = ",";
if (operator === "?") {
separator = "&";
} else if (operator !== "#") {
separator = operator;
}
return (values.length !== 0 ? operator : "") + values.join(separator);
} else {
return values.join(",");
}
} else {
return encodeReserved(literal);
}
});
}
function parse(options) {
// https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
@ -97,7 +276,7 @@ function parse(options) {
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
const urlVariableNames = extractUrlVariableNames(url);
url = urlTemplate.parse(url).expand(parameters);
url = parseUrl(url).expand(parameters);
if (!/^http/.test(url)) {
url = options.baseUrl + url;
@ -178,7 +357,7 @@ function withDefaults(oldDefaults, newDefaults) {
const VERSION = "0.0.0-development";
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`;
const DEFAULTS = {
method: "GET",
baseUrl: "https://api.github.com",
@ -195,3 +374,4 @@ const DEFAULTS = {
const endpoint = withDefaults(null, DEFAULTS);
exports.endpoint = endpoint;
//# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import getUserAgent from "universal-user-agent";
import { getUserAgent } from "universal-user-agent";
import { VERSION } from "./version";
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
export const DEFAULTS = {

View File

@ -1,6 +1,5 @@
import deepmerge from "deepmerge";
import isPlainObject from "is-plain-object";
import { lowercaseKeys } from "./util/lowercase-keys";
import { mergeDeep } from "./util/merge-deep";
export function merge(defaults, route, options) {
if (typeof route === "string") {
let [method, url] = route.split(" ");
@ -11,9 +10,7 @@ export function merge(defaults, route, options) {
}
// lowercase header names before merging with defaults to avoid duplicates
options.headers = lowercaseKeys(options.headers);
const mergedOptions = deepmerge.all([defaults, options].filter(Boolean), {
isMergeableObject: isPlainObject
});
const mergedOptions = mergeDeep(defaults || {}, options);
// mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews

View File

@ -1,7 +1,7 @@
import urlTemplate from "url-template";
import { addQueryParameters } from "./util/add-query-parameters";
import { extractUrlVariableNames } from "./util/extract-url-variable-names";
import { omit } from "./util/omit";
import { parseUrl } from "./util/url-template";
export function parse(options) {
// https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase();
@ -19,7 +19,7 @@ export function parse(options) {
]);
// extract variable names from URL to calculate remaining variables later
const urlVariableNames = extractUrlVariableNames(url);
url = urlTemplate.parse(url).expand(parameters);
url = parseUrl(url).expand(parameters);
if (!/^http/.test(url)) {
url = options.baseUrl + url;
}

View File

@ -0,0 +1,16 @@
import isPlainObject from "is-plain-object";
export function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => {
if (isPlainObject(options[key])) {
if (!(key in defaults))
Object.assign(result, { [key]: options[key] });
else
result[key] = mergeDeep(defaults[key], options[key]);
}
else {
Object.assign(result, { [key]: options[key] });
}
});
return result;
}

View File

@ -0,0 +1,170 @@
// Based on https://github.com/bramstein/url-template, licensed under BSD
// TODO: create separate package.
//
// Copyright (c) 2012-2014, Bram Stein
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* istanbul ignore file */
function encodeReserved(str) {
return str
.split(/(%[0-9A-Fa-f]{2})/g)
.map(function (part) {
if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part)
.replace(/%5B/g, "[")
.replace(/%5D/g, "]");
}
return part;
})
.join("");
}
function encodeUnreserved(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return ("%" +
c
.charCodeAt(0)
.toString(16)
.toUpperCase());
});
}
function encodeValue(operator, value, key) {
value =
operator === "+" || operator === "#"
? encodeReserved(value)
: encodeUnreserved(value);
if (key) {
return encodeUnreserved(key) + "=" + value;
}
else {
return value;
}
}
function isDefined(value) {
return value !== undefined && value !== null;
}
function isKeyOperator(operator) {
return operator === ";" || operator === "&" || operator === "?";
}
function getValues(context, operator, key, modifier) {
var value = context[key], result = [];
if (isDefined(value) && value !== "") {
if (typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean") {
value = value.toString();
if (modifier && modifier !== "*") {
value = value.substring(0, parseInt(modifier, 10));
}
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
}
else {
if (modifier === "*") {
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
});
}
else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
result.push(encodeValue(operator, value[k], k));
}
});
}
}
else {
const tmp = [];
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
tmp.push(encodeValue(operator, value));
});
}
else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
tmp.push(encodeUnreserved(k));
tmp.push(encodeValue(operator, value[k].toString()));
}
});
}
if (isKeyOperator(operator)) {
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
}
else if (tmp.length !== 0) {
result.push(tmp.join(","));
}
}
}
}
else {
if (operator === ";") {
if (isDefined(value)) {
result.push(encodeUnreserved(key));
}
}
else if (value === "" && (operator === "&" || operator === "?")) {
result.push(encodeUnreserved(key) + "=");
}
else if (value === "") {
result.push("");
}
}
return result;
}
export function parseUrl(template) {
return {
expand: expand.bind(null, template)
};
}
function expand(template, context) {
var operators = ["+", "#", ".", "/", ";", "?", "&"];
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
if (expression) {
let operator = "";
const values = [];
if (operators.indexOf(expression.charAt(0)) !== -1) {
operator = expression.charAt(0);
expression = expression.substr(1);
}
expression.split(/,/g).forEach(function (variable) {
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
});
if (operator && operator !== "+") {
var separator = ",";
if (operator === "?") {
separator = "&";
}
else if (operator !== "#") {
separator = operator;
}
return (values.length !== 0 ? operator : "") + values.join(separator);
}
else {
return values.join(",");
}
}
else {
return encodeReserved(literal);
}
});
}

View File

@ -1,3 +1,5 @@
export declare function lowercaseKeys(object?: {
[key: string]: any;
}): {};
}): {
[key: string]: any;
};

View File

@ -0,0 +1 @@
export declare function mergeDeep(defaults: any, options: any): object;

View File

@ -0,0 +1,3 @@
export declare function parseUrl(template: string): {
expand: (context: object) => string;
};

View File

@ -1,233 +1,377 @@
import deepmerge from 'deepmerge';
import isPlainObject from 'is-plain-object';
import urlTemplate from 'url-template';
import getUserAgent from 'universal-user-agent';
function _slicedToArray(arr, i) {
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
}
function _arrayWithHoles(arr) {
if (Array.isArray(arr)) return arr;
}
function _iterableToArrayLimit(arr, i) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
_arr.push(_s.value);
if (i && _arr.length === i) break;
}
} catch (err) {
_d = true;
_e = err;
} finally {
try {
if (!_n && _i["return"] != null) _i["return"]();
} finally {
if (_d) throw _e;
}
}
return _arr;
}
function _nonIterableRest() {
throw new TypeError("Invalid attempt to destructure non-iterable instance");
}
import { getUserAgent } from 'universal-user-agent';
function lowercaseKeys(object) {
if (!object) {
return {};
}
if (!object) {
return {};
}
return Object.keys(object).reduce((newObj, key) => {
newObj[key.toLowerCase()] = object[key];
return newObj;
}, {});
}
return Object.keys(object).reduce((newObj, key) => {
newObj[key.toLowerCase()] = object[key];
return newObj;
}, {});
function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => {
if (isPlainObject(options[key])) {
if (!(key in defaults))
Object.assign(result, { [key]: options[key] });
else
result[key] = mergeDeep(defaults[key], options[key]);
}
else {
Object.assign(result, { [key]: options[key] });
}
});
return result;
}
function merge(defaults, route, options) {
if (typeof route === "string") {
let _route$split = route.split(" "),
_route$split2 = _slicedToArray(_route$split, 2),
method = _route$split2[0],
url = _route$split2[1];
options = Object.assign(url ? {
method,
url
} : {
url: method
}, options);
} else {
options = route || {};
} // lowercase header names before merging with defaults to avoid duplicates
options.headers = lowercaseKeys(options.headers);
const mergedOptions = deepmerge.all([defaults, options].filter(Boolean), {
isMergeableObject: isPlainObject
}); // mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews.filter(preview => !mergedOptions.mediaType.previews.includes(preview)).concat(mergedOptions.mediaType.previews);
}
mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map(preview => preview.replace(/-preview/, ""));
return mergedOptions;
if (typeof route === "string") {
let [method, url] = route.split(" ");
options = Object.assign(url ? { method, url } : { url: method }, options);
}
else {
options = route || {};
}
// lowercase header names before merging with defaults to avoid duplicates
options.headers = lowercaseKeys(options.headers);
const mergedOptions = mergeDeep(defaults || {}, options);
// mediaType.previews arrays are merged, instead of overwritten
if (defaults && defaults.mediaType.previews.length) {
mergedOptions.mediaType.previews = defaults.mediaType.previews
.filter(preview => !mergedOptions.mediaType.previews.includes(preview))
.concat(mergedOptions.mediaType.previews);
}
mergedOptions.mediaType.previews = mergedOptions.mediaType.previews.map((preview) => preview.replace(/-preview/, ""));
return mergedOptions;
}
function addQueryParameters(url, parameters) {
const separator = /\?/.test(url) ? "&" : "?";
const names = Object.keys(parameters);
if (names.length === 0) {
return url;
}
return url + separator + names.map(name => {
if (name === "q") {
return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
const separator = /\?/.test(url) ? "&" : "?";
const names = Object.keys(parameters);
if (names.length === 0) {
return url;
}
return "".concat(name, "=").concat(encodeURIComponent(parameters[name]));
}).join("&");
return (url +
separator +
names
.map(name => {
if (name === "q") {
return ("q=" +
parameters
.q.split("+")
.map(encodeURIComponent)
.join("+"));
}
return `${name}=${encodeURIComponent(parameters[name])}`;
})
.join("&"));
}
const urlVariableRegex = /\{[^}]+\}/g;
function removeNonChars(variableName) {
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
}
function extractUrlVariableNames(url) {
const matches = url.match(urlVariableRegex);
if (!matches) {
return [];
}
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
const matches = url.match(urlVariableRegex);
if (!matches) {
return [];
}
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
}
function omit(object, keysToOmit) {
return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => {
obj[key] = object[key];
return obj;
}, {});
return Object.keys(object)
.filter(option => !keysToOmit.includes(option))
.reduce((obj, key) => {
obj[key] = object[key];
return obj;
}, {});
}
// Based on https://github.com/bramstein/url-template, licensed under BSD
// TODO: create separate package.
//
// Copyright (c) 2012-2014, Bram Stein
// All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/* istanbul ignore file */
function encodeReserved(str) {
return str
.split(/(%[0-9A-Fa-f]{2})/g)
.map(function (part) {
if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part)
.replace(/%5B/g, "[")
.replace(/%5D/g, "]");
}
return part;
})
.join("");
}
function encodeUnreserved(str) {
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return ("%" +
c
.charCodeAt(0)
.toString(16)
.toUpperCase());
});
}
function encodeValue(operator, value, key) {
value =
operator === "+" || operator === "#"
? encodeReserved(value)
: encodeUnreserved(value);
if (key) {
return encodeUnreserved(key) + "=" + value;
}
else {
return value;
}
}
function isDefined(value) {
return value !== undefined && value !== null;
}
function isKeyOperator(operator) {
return operator === ";" || operator === "&" || operator === "?";
}
function getValues(context, operator, key, modifier) {
var value = context[key], result = [];
if (isDefined(value) && value !== "") {
if (typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean") {
value = value.toString();
if (modifier && modifier !== "*") {
value = value.substring(0, parseInt(modifier, 10));
}
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
}
else {
if (modifier === "*") {
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
result.push(encodeValue(operator, value, isKeyOperator(operator) ? key : ""));
});
}
else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
result.push(encodeValue(operator, value[k], k));
}
});
}
}
else {
const tmp = [];
if (Array.isArray(value)) {
value.filter(isDefined).forEach(function (value) {
tmp.push(encodeValue(operator, value));
});
}
else {
Object.keys(value).forEach(function (k) {
if (isDefined(value[k])) {
tmp.push(encodeUnreserved(k));
tmp.push(encodeValue(operator, value[k].toString()));
}
});
}
if (isKeyOperator(operator)) {
result.push(encodeUnreserved(key) + "=" + tmp.join(","));
}
else if (tmp.length !== 0) {
result.push(tmp.join(","));
}
}
}
}
else {
if (operator === ";") {
if (isDefined(value)) {
result.push(encodeUnreserved(key));
}
}
else if (value === "" && (operator === "&" || operator === "?")) {
result.push(encodeUnreserved(key) + "=");
}
else if (value === "") {
result.push("");
}
}
return result;
}
function parseUrl(template) {
return {
expand: expand.bind(null, template)
};
}
function expand(template, context) {
var operators = ["+", "#", ".", "/", ";", "?", "&"];
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
if (expression) {
let operator = "";
const values = [];
if (operators.indexOf(expression.charAt(0)) !== -1) {
operator = expression.charAt(0);
expression = expression.substr(1);
}
expression.split(/,/g).forEach(function (variable) {
var tmp = /([^:\*]*)(?::(\d+)|(\*))?/.exec(variable);
values.push(getValues(context, operator, tmp[1], tmp[2] || tmp[3]));
});
if (operator && operator !== "+") {
var separator = ",";
if (operator === "?") {
separator = "&";
}
else if (operator !== "#") {
separator = operator;
}
return (values.length !== 0 ? operator : "") + values.join(separator);
}
else {
return values.join(",");
}
}
else {
return encodeReserved(literal);
}
});
}
function parse(options) {
// https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
let url = options.url.replace(/:([a-z]\w+)/g, "{+$1}");
let headers = Object.assign({}, options.headers);
let body;
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
const urlVariableNames = extractUrlVariableNames(url);
url = urlTemplate.parse(url).expand(parameters);
if (!/^http/.test(url)) {
url = options.baseUrl + url;
}
const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
const remainingParameters = omit(parameters, omittedParameters);
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
if (!isBinaryRequset) {
if (options.mediaType.format) {
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
headers.accept = headers.accept.split(/,/).map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, "application/vnd$1$2.".concat(options.mediaType.format))).join(",");
// https://fetch.spec.whatwg.org/#methods
let method = options.method.toUpperCase();
// replace :varname with {varname} to make it RFC 6570 compatible
let url = options.url.replace(/:([a-z]\w+)/g, "{+$1}");
let headers = Object.assign({}, options.headers);
let body;
let parameters = omit(options, [
"method",
"baseUrl",
"url",
"headers",
"request",
"mediaType"
]);
// extract variable names from URL to calculate remaining variables later
const urlVariableNames = extractUrlVariableNames(url);
url = parseUrl(url).expand(parameters);
if (!/^http/.test(url)) {
url = options.baseUrl + url;
}
if (options.mediaType.previews.length) {
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => {
const format = options.mediaType.format ? ".".concat(options.mediaType.format) : "+json";
return "application/vnd.github.".concat(preview, "-preview").concat(format);
}).join(",");
const omittedParameters = Object.keys(options)
.filter(option => urlVariableNames.includes(option))
.concat("baseUrl");
const remainingParameters = omit(parameters, omittedParameters);
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
if (!isBinaryRequset) {
if (options.mediaType.format) {
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
headers.accept = headers.accept
.split(/,/)
.map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
.join(",");
}
if (options.mediaType.previews.length) {
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader
.concat(options.mediaType.previews)
.map(preview => {
const format = options.mediaType.format
? `.${options.mediaType.format}`
: "+json";
return `application/vnd.github.${preview}-preview${format}`;
})
.join(",");
}
}
} // for GET/HEAD requests, set URL query parameters from remaining parameters
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
if (["GET", "HEAD"].includes(method)) {
url = addQueryParameters(url, remainingParameters);
} else {
if ("data" in remainingParameters) {
body = remainingParameters.data;
} else {
if (Object.keys(remainingParameters).length) {
body = remainingParameters;
} else {
headers["content-length"] = 0;
}
// for GET/HEAD requests, set URL query parameters from remaining parameters
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
if (["GET", "HEAD"].includes(method)) {
url = addQueryParameters(url, remainingParameters);
}
} // default content-type for JSON if body is set
if (!headers["content-type"] && typeof body !== "undefined") {
headers["content-type"] = "application/json; charset=utf-8";
} // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.
// fetch does not allow to set `content-length` header, but we can set body to an empty string
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
body = "";
} // Only return body/request keys if present
return Object.assign({
method,
url,
headers
}, typeof body !== "undefined" ? {
body
} : null, options.request ? {
request: options.request
} : null);
else {
if ("data" in remainingParameters) {
body = remainingParameters.data;
}
else {
if (Object.keys(remainingParameters).length) {
body = remainingParameters;
}
else {
headers["content-length"] = 0;
}
}
}
// default content-type for JSON if body is set
if (!headers["content-type"] && typeof body !== "undefined") {
headers["content-type"] = "application/json; charset=utf-8";
}
// GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.
// fetch does not allow to set `content-length` header, but we can set body to an empty string
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
body = "";
}
// Only return body/request keys if present
return Object.assign({ method, url, headers }, typeof body !== "undefined" ? { body } : null, options.request ? { request: options.request } : null);
}
function endpointWithDefaults(defaults, route, options) {
return parse(merge(defaults, route, options));
return parse(merge(defaults, route, options));
}
function withDefaults(oldDefaults, newDefaults) {
const DEFAULTS = merge(oldDefaults, newDefaults);
const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
return Object.assign(endpoint, {
DEFAULTS,
defaults: withDefaults.bind(null, DEFAULTS),
merge: merge.bind(null, DEFAULTS),
parse
});
const DEFAULTS = merge(oldDefaults, newDefaults);
const endpoint = endpointWithDefaults.bind(null, DEFAULTS);
return Object.assign(endpoint, {
DEFAULTS,
defaults: withDefaults.bind(null, DEFAULTS),
merge: merge.bind(null, DEFAULTS),
parse
});
}
const VERSION = "0.0.0-development";
const userAgent = "octokit-endpoint.js/".concat(VERSION, " ").concat(getUserAgent());
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
const DEFAULTS = {
method: "GET",
baseUrl: "https://api.github.com",
headers: {
accept: "application/vnd.github.v3+json",
"user-agent": userAgent
},
mediaType: {
format: "",
previews: []
}
method: "GET",
baseUrl: "https://api.github.com",
headers: {
accept: "application/vnd.github.v3+json",
"user-agent": userAgent
},
mediaType: {
format: "",
previews: []
}
};
const endpoint = withDefaults(null, DEFAULTS);
export { endpoint };
//# sourceMappingURL=index.js.map

1
node_modules/@octokit/endpoint/dist-web/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
language: node_js
cache: npm
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
only:
- master
- /^greenkeeper.*$/
stages:
- test
- name: release
if: branch = master AND type IN (push)
jobs:
include:
- stage: test
node_js: 12
script: npm run test
- node_js: 8
script: npm run test
- node_js: 10
env: Node 10 & coverage upload
script:
- npm run test
- npm run coverage:upload
- node_js: lts/*
env: browser tests
script: npm run test:browser
- stage: release
node_js: lts/*
env: semantic-release
script: npm run semantic-release

View File

@ -4,13 +4,13 @@
[![@latest](https://img.shields.io/npm/v/universal-user-agent.svg)](https://www.npmjs.com/package/universal-user-agent)
[![Build Status](https://travis-ci.com/gr2m/universal-user-agent.svg?branch=master)](https://travis-ci.com/gr2m/universal-user-agent)
[![Coverage Status](https://coveralls.io/repos/github/gr2m/universal-user-agent/badge.svg)](https://coveralls.io/github/gr2m/universal-user-agent)
[![Greenkeeper](https://badges.greenkeeper.io/gr2m/universal-user-agent.svg)](https://greenkeeper.io/)
```js
const getUserAgent = require('universal-user-agent')
const userAgent = getUserAgent()
const { getUserAgent } = require("universal-user-agent");
// or import { getUserAgent } from "universal-user-agent";
const userAgent = getUserAgent();
// userAgent will look like this
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)

View File

@ -1,6 +0,0 @@
module.exports = getUserAgentBrowser
function getUserAgentBrowser () {
/* global navigator */
return navigator.userAgent
}

View File

@ -1,4 +0,0 @@
{
"integrationFolder": "test",
"video": false
}

View File

@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var osName = _interopDefault(require('os-name'));
function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}
exports.getUserAgent = getUserAgent;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/node.js"],"sourcesContent":["import osName from \"os-name\";\nexport function getUserAgent() {\n try {\n return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;\n }\n catch (error) {\n if (/wmic os get Caption/.test(error.message)) {\n return \"Windows <version undetectable>\";\n }\n throw error;\n }\n}\n"],"names":["getUserAgent","process","version","substr","osName","arch","error","test","message"],"mappings":";;;;;;;;AACO,SAASA,YAAT,GAAwB;MACvB;WACQ,WAAUC,OAAO,CAACC,OAAR,CAAgBC,MAAhB,CAAuB,CAAvB,CAA0B,KAAIC,MAAM,EAAG,KAAIH,OAAO,CAACI,IAAK,GAA1E;GADJ,CAGA,OAAOC,KAAP,EAAc;QACN,sBAAsBC,IAAtB,CAA2BD,KAAK,CAACE,OAAjC,CAAJ,EAA+C;aACpC,gCAAP;;;UAEEF,KAAN;;;;;;"}

View File

@ -0,0 +1,3 @@
export function getUserAgent() {
return navigator.userAgent;
}

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1,12 @@
import osName from "os-name";
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1,6 @@
function getUserAgent() {
return navigator.userAgent;
}
export { getUserAgent };
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/browser.js"],"sourcesContent":["export function getUserAgent() {\n return navigator.userAgent;\n}\n"],"names":[],"mappings":"AAAO,SAAS,YAAY,GAAG;IAC3B,OAAO,SAAS,CAAC,SAAS,CAAC;CAC9B;;;;"}

View File

@ -1 +0,0 @@
export default function getUserAgentNode(): string;

View File

@ -1,15 +0,0 @@
module.exports = getUserAgentNode
const osName = require('os-name')
function getUserAgentNode () {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return 'Windows <version undetectable>'
}
throw error
}
}

View File

@ -1,85 +1,65 @@
{
"_args": [
[
"universal-user-agent@3.0.0",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "universal-user-agent@3.0.0",
"_id": "universal-user-agent@3.0.0",
"_from": "universal-user-agent@^4.0.0",
"_id": "universal-user-agent@4.0.0",
"_inBundle": false,
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
"_location": "/@octokit/endpoint/universal-user-agent",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "universal-user-agent@3.0.0",
"raw": "universal-user-agent@^4.0.0",
"name": "universal-user-agent",
"escapedName": "universal-user-agent",
"rawSpec": "3.0.0",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/@octokit/endpoint"
],
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
},
"browser": "browser.js",
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
"_shasum": "27da2ec87e32769619f68a14996465ea1cb9df16",
"_spec": "universal-user-agent@^4.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/endpoint",
"bugs": {
"url": "https://github.com/gr2m/universal-user-agent/issues"
},
"bundleDependencies": false,
"dependencies": {
"os-name": "^3.0.0"
"os-name": "^3.1.0"
},
"deprecated": false,
"description": "Get a user agent string in both browser and node",
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cypress": "^3.1.0",
"mocha": "^6.0.0",
"nyc": "^14.0.0",
"proxyquire": "^2.1.0",
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.6.0",
"@pika/plugin-ts-standard-pkg": "^0.6.0",
"@types/jest": "^24.0.18",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"semantic-release": "^15.9.15",
"sinon": "^7.2.4",
"sinon-chai": "^3.2.0",
"standard": "^13.0.1",
"test": "^0.6.0",
"travis-deploy-once": "^5.0.7"
"ts-jest": "^24.0.2",
"typescript": "^3.6.2"
},
"files": [
"dist-*/",
"bin/"
],
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"main": "dist-node/index.js",
"module": "dist-web/index.js",
"name": "universal-user-agent",
"pika": true,
"repository": {
"type": "git",
"url": "git+https://github.com/gr2m/universal-user-agent.git"
},
"scripts": {
"coverage": "nyc report --reporter=html && open coverage/index.html",
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
"pretest": "standard",
"semantic-release": "semantic-release",
"test": "nyc mocha \"test/*-test.js\"",
"test:browser": "cypress run --browser chrome",
"travis-deploy-once": "travis-deploy-once"
},
"standard": {
"globals": [
"describe",
"it",
"beforeEach",
"afterEach",
"expect"
]
},
"types": "index.d.ts",
"version": "3.0.0"
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "4.0.0"
}

View File

@ -1,57 +0,0 @@
// make tests run in both Node & Express
if (!global.cy) {
const chai = require('chai')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
chai.use(sinonChai)
global.expect = chai.expect
let sandbox
beforeEach(() => {
sandbox = sinon.createSandbox()
global.cy = {
stub: function () {
return sandbox.stub.apply(sandbox, arguments)
},
log () {
console.log.apply(console, arguments)
}
}
})
afterEach(() => {
sandbox.restore()
})
}
const getUserAgent = require('..')
describe('smoke', () => {
it('works', () => {
expect(getUserAgent()).to.be.a('string')
expect(getUserAgent().length).to.be.above(10)
})
if (!process.browser) { // test on node only
const proxyquire = require('proxyquire').noCallThru()
it('works around wmic error on Windows (#5)', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('Command failed: wmic os get Caption')
}
})
expect(getUserAgent()).to.equal('Windows <version undetectable>')
})
it('does not swallow unexpected errors', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('oops')
}
})
expect(getUserAgent).to.throw('oops')
})
}
})

View File

@ -1,58 +1,50 @@
{
"_args": [
[
"@octokit/endpoint@5.3.2",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@octokit/endpoint@5.3.2",
"_id": "@octokit/endpoint@5.3.2",
"_from": "@octokit/endpoint@^5.1.0",
"_id": "@octokit/endpoint@5.3.5",
"_inBundle": false,
"_integrity": "sha512-gRjteEM9I6f4D8vtwU2iGUTn9RX/AJ0SVXiqBUEuYEWVGGAVjSXdT0oNmghH5lvQNWs8mwt6ZaultuG6yXivNw==",
"_integrity": "sha512-f8KqzIrnzPLiezDsZZPB+K8v8YSv6aKFl7eOu59O46lmlW4HagWl1U6NWl6LmT8d1w7NsKBI3paVtzcnRGO1gw==",
"_location": "/@octokit/endpoint",
"_phantomChildren": {
"os-name": "3.1.0"
},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/endpoint@5.3.2",
"raw": "@octokit/endpoint@^5.1.0",
"name": "@octokit/endpoint",
"escapedName": "@octokit%2fendpoint",
"scope": "@octokit",
"rawSpec": "5.3.2",
"rawSpec": "^5.1.0",
"saveSpec": null,
"fetchSpec": "5.3.2"
"fetchSpec": "^5.1.0"
},
"_requiredBy": [
"/@octokit/request"
],
"_resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.2.tgz",
"_spec": "5.3.2",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"_resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.5.tgz",
"_shasum": "2822c3b01107806dbdce3863b6205e3eff4289ed",
"_spec": "@octokit/endpoint@^5.1.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/request",
"bugs": {
"url": "https://github.com/octokit/endpoint.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"deepmerge": "4.0.0",
"is-plain-object": "^3.0.0",
"universal-user-agent": "^3.0.0",
"url-template": "^2.0.8"
"universal-user-agent": "^4.0.0"
},
"deprecated": false,
"description": "Turns REST API endpoints into generic request options",
"devDependencies": {
"@octokit/routes": "20.9.2",
"@pika/pack": "^0.4.0",
"@pika/plugin-build-node": "^0.4.0",
"@pika/plugin-build-web": "^0.4.0",
"@pika/plugin-ts-standard-pkg": "^0.4.0",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.6.0",
"@pika/plugin-build-web": "^0.6.0",
"@pika/plugin-ts-standard-pkg": "^0.6.0",
"@types/jest": "^24.0.11",
"@types/url-template": "^2.0.28",
"glob": "^7.1.3",
"handlebars": "^4.1.2",
"jest": "^24.7.1",
"lodash.set": "^4.3.2",
"nyc": "^14.0.0",
"pascal-case": "^2.0.1",
"prettier": "1.18.2",
"semantic-release": "^15.13.8",
@ -87,5 +79,5 @@
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "5.3.2"
"version": "5.3.5"
}

View File

@ -1,33 +1,28 @@
{
"_args": [
[
"@octokit/graphql@2.1.3",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@octokit/graphql@2.1.3",
"_from": "@octokit/graphql@^2.0.1",
"_id": "@octokit/graphql@2.1.3",
"_inBundle": false,
"_integrity": "sha512-XoXJqL2ondwdnMIW3wtqJWEwcBfKk37jO/rYkoxNPEVeLBDGsGO1TCWggrAlq3keGt/O+C/7VepXnukUxwt5vA==",
"_location": "/@octokit/graphql",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/graphql@2.1.3",
"raw": "@octokit/graphql@^2.0.1",
"name": "@octokit/graphql",
"escapedName": "@octokit%2fgraphql",
"scope": "@octokit",
"rawSpec": "2.1.3",
"rawSpec": "^2.0.1",
"saveSpec": null,
"fetchSpec": "2.1.3"
"fetchSpec": "^2.0.1"
},
"_requiredBy": [
"/@actions/github"
],
"_resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-2.1.3.tgz",
"_spec": "2.1.3",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"_shasum": "60c058a0ed5fa242eca6f938908d95fd1a2f4b92",
"_spec": "@octokit/graphql@^2.0.1",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@actions/github",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
@ -35,6 +30,7 @@
"bugs": {
"url": "https://github.com/octokit/graphql.js/issues"
},
"bundleDependencies": false,
"bundlesize": [
{
"path": "./dist/octokit-graphql.min.js.gz",
@ -45,6 +41,7 @@
"@octokit/request": "^5.0.0",
"universal-user-agent": "^2.0.3"
},
"deprecated": false,
"description": "GitHub GraphQL API client for browsers and Node",
"devDependencies": {
"chai": "^4.2.0",

View File

@ -1,41 +1,38 @@
{
"_args": [
[
"@octokit/request-error@1.0.4",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@octokit/request-error@1.0.4",
"_from": "@octokit/request-error@^1.0.1",
"_id": "@octokit/request-error@1.0.4",
"_inBundle": false,
"_integrity": "sha512-L4JaJDXn8SGT+5G0uX79rZLv0MNJmfGa4vb4vy1NnpjSnWDLJRy6m90udGwvMmavwsStgbv2QNkPzzTCMmL+ig==",
"_location": "/@octokit/request-error",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/request-error@1.0.4",
"raw": "@octokit/request-error@^1.0.1",
"name": "@octokit/request-error",
"escapedName": "@octokit%2frequest-error",
"scope": "@octokit",
"rawSpec": "1.0.4",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "1.0.4"
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/@octokit/request",
"/@octokit/rest"
],
"_resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-1.0.4.tgz",
"_spec": "1.0.4",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"_shasum": "15e1dc22123ba4a9a4391914d80ec1e5303a23be",
"_spec": "@octokit/request-error@^1.0.1",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/request",
"bugs": {
"url": "https://github.com/octokit/request-error.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
"deprecated": false,
"description": "Error class for Octokit request errors",
"devDependencies": {
"@pika/pack": "^0.3.7",

View File

@ -42,13 +42,17 @@ request("POST /repos/:owner/:repo/issues/:number/labels", {
mediaType: {
previews: ["symmetra"]
},
owner: "ocotkit",
owner: "octokit",
repo: "request.js",
number: 1,
labels: ["🐛 bug"]
});
```
👶 [Small bundle size](https://bundlephobia.com/result?p=@octokit/request@5.0.3) (\<4kb minified + gzipped)
😎 [Authenticate](#authentication) with any of [GitHubs Authentication Strategies](https://github.com/octokit/auth.js).
👍 Sensible defaults
- `baseUrl`: `https://api.github.com`
@ -59,8 +63,6 @@ request("POST /repos/:owner/:repo/issues/:number/labels", {
🧐 Simple to debug: Sets `error.request` to request options causing the error (with redacted credentials).
👶 Small bundle size (\<5kb minified + gzipped)
## Usage
<table>
@ -110,6 +112,8 @@ console.log(`${result.data.length} repos found.`);
### GraphQL example
For GraphQL request we recommend using [`@octokit/graphql`](https://github.com/octokit/graphql.js#readme)
```js
const result = await request("POST /graphql", {
headers: {
@ -144,6 +148,45 @@ const result = await request({
});
```
## Authentication
The simplest way to authenticate a request is to set the `Authorization` header directly, e.g. to a [personal access token](https://github.com/settings/tokens/).
```js
const requestWithAuth = request.defaults({
headers: {
authorization: "token 0000000000000000000000000000000000000001"
}
});
const result = await request("GET /user");
```
For more complex authentication strategies such as GitHub Apps or Basic, we recommend the according authentication library exported by [`@octokit/auth`](https://github.com/octokit/auth.js).
```js
const { createAppAuth } = require("@octokit/auth-app");
const auth = createAppAuth({
id: process.env.APP_ID,
privateKey: process.env.PRIVATE_KEY,
installationId: 123
});
const requestWithAuth = request.defaults({
request: {
hook: auth.hook
},
mediaType: {
previews: ["machine-man"]
}
});
const { data: app } = await requestWithAuth("GET /app");
const { data: app } = await requestWithAuth("POST /repos/:owner/:repo/issues", {
owner: "octocat",
repo: "hello-world",
title: "Hello from the engine room"
});
```
## request()
`request(route, options)` or `request(options)`.
@ -425,10 +468,10 @@ const options = request.endpoint("GET /orgs/:org/repos", {
All of the [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) API can be used:
- [`ocotkitRequest.endpoint()`](#endpoint)
- [`ocotkitRequest.endpoint.defaults()`](#endpointdefaults)
- [`ocotkitRequest.endpoint.merge()`](#endpointdefaults)
- [`ocotkitRequest.endpoint.parse()`](#endpointmerge)
- [`octokitRequest.endpoint()`](#endpoint)
- [`octokitRequest.endpoint.defaults()`](#endpointdefaults)
- [`octokitRequest.endpoint.merge()`](#endpointdefaults)
- [`octokitRequest.endpoint.parse()`](#endpointmerge)
## Special cases

View File

@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var endpoint = require('@octokit/endpoint');
var getUserAgent = _interopDefault(require('universal-user-agent'));
var universalUserAgent = require('universal-user-agent');
var isPlainObject = _interopDefault(require('is-plain-object'));
var nodeFetch = _interopDefault(require('node-fetch'));
var requestError = require('@octokit/request-error');
@ -136,8 +136,9 @@ function withDefaults(oldEndpoint, newDefaults) {
const request = withDefaults(endpoint.endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
"user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
}
});
exports.request = request;
//# sourceMappingURL=index.js.map

1
node_modules/@octokit/request/dist-node/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import { endpoint } from "@octokit/endpoint";
import getUserAgent from "universal-user-agent";
import { getUserAgent } from "universal-user-agent";
import { VERSION } from "./version";
import withDefaults from "./with-defaults";
export const request = withDefaults(endpoint, {

View File

@ -1,5 +1,5 @@
import { endpoint } from '@octokit/endpoint';
import getUserAgent from 'universal-user-agent';
import { getUserAgent } from 'universal-user-agent';
import isPlainObject from 'is-plain-object';
import nodeFetch from 'node-fetch';
import { RequestError } from '@octokit/request-error';
@ -124,3 +124,4 @@ const request = withDefaults(endpoint, {
});
export { request };
//# sourceMappingURL=index.js.map

1
node_modules/@octokit/request/dist-web/index.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,35 +0,0 @@
language: node_js
cache: npm
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
only:
- master
- /^greenkeeper.*$/
stages:
- test
- name: release
if: branch = master AND type IN (push)
jobs:
include:
- stage: test
node_js: 12
script: npm run test
- node_js: 8
script: npm run test
- node_js: 10
env: Node 10 & coverage upload
script:
- npm run test
- npm run coverage:upload
- node_js: lts/*
env: browser tests
script: npm run test:browser
- stage: release
node_js: lts/*
env: semantic-release
script: npm run semantic-release

View File

@ -4,13 +4,13 @@
[![@latest](https://img.shields.io/npm/v/universal-user-agent.svg)](https://www.npmjs.com/package/universal-user-agent)
[![Build Status](https://travis-ci.com/gr2m/universal-user-agent.svg?branch=master)](https://travis-ci.com/gr2m/universal-user-agent)
[![Coverage Status](https://coveralls.io/repos/github/gr2m/universal-user-agent/badge.svg)](https://coveralls.io/github/gr2m/universal-user-agent)
[![Greenkeeper](https://badges.greenkeeper.io/gr2m/universal-user-agent.svg)](https://greenkeeper.io/)
```js
const getUserAgent = require('universal-user-agent')
const userAgent = getUserAgent()
const { getUserAgent } = require("universal-user-agent");
// or import { getUserAgent } from "universal-user-agent";
const userAgent = getUserAgent();
// userAgent will look like this
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)

View File

@ -1,6 +0,0 @@
module.exports = getUserAgentBrowser
function getUserAgentBrowser () {
/* global navigator */
return navigator.userAgent
}

View File

@ -1,4 +0,0 @@
{
"integrationFolder": "test",
"video": false
}

View File

@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var osName = _interopDefault(require('os-name'));
function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}
exports.getUserAgent = getUserAgent;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/node.js"],"sourcesContent":["import osName from \"os-name\";\nexport function getUserAgent() {\n try {\n return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;\n }\n catch (error) {\n if (/wmic os get Caption/.test(error.message)) {\n return \"Windows <version undetectable>\";\n }\n throw error;\n }\n}\n"],"names":["getUserAgent","process","version","substr","osName","arch","error","test","message"],"mappings":";;;;;;;;AACO,SAASA,YAAT,GAAwB;MACvB;WACQ,WAAUC,OAAO,CAACC,OAAR,CAAgBC,MAAhB,CAAuB,CAAvB,CAA0B,KAAIC,MAAM,EAAG,KAAIH,OAAO,CAACI,IAAK,GAA1E;GADJ,CAGA,OAAOC,KAAP,EAAc;QACN,sBAAsBC,IAAtB,CAA2BD,KAAK,CAACE,OAAjC,CAAJ,EAA+C;aACpC,gCAAP;;;UAEEF,KAAN;;;;;;"}

View File

@ -0,0 +1,3 @@
export function getUserAgent() {
return navigator.userAgent;
}

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1,12 @@
import osName from "os-name";
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1,6 @@
function getUserAgent() {
return navigator.userAgent;
}
export { getUserAgent };
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/browser.js"],"sourcesContent":["export function getUserAgent() {\n return navigator.userAgent;\n}\n"],"names":[],"mappings":"AAAO,SAAS,YAAY,GAAG;IAC3B,OAAO,SAAS,CAAC,SAAS,CAAC;CAC9B;;;;"}

View File

@ -1 +0,0 @@
export default function getUserAgentNode(): string;

View File

@ -1,15 +0,0 @@
module.exports = getUserAgentNode
const osName = require('os-name')
function getUserAgentNode () {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return 'Windows <version undetectable>'
}
throw error
}
}

View File

@ -1,85 +1,65 @@
{
"_args": [
[
"universal-user-agent@3.0.0",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "universal-user-agent@3.0.0",
"_id": "universal-user-agent@3.0.0",
"_from": "universal-user-agent@^4.0.0",
"_id": "universal-user-agent@4.0.0",
"_inBundle": false,
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
"_location": "/@octokit/request/universal-user-agent",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "universal-user-agent@3.0.0",
"raw": "universal-user-agent@^4.0.0",
"name": "universal-user-agent",
"escapedName": "universal-user-agent",
"rawSpec": "3.0.0",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/@octokit/request"
],
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
},
"browser": "browser.js",
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
"_shasum": "27da2ec87e32769619f68a14996465ea1cb9df16",
"_spec": "universal-user-agent@^4.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/request",
"bugs": {
"url": "https://github.com/gr2m/universal-user-agent/issues"
},
"bundleDependencies": false,
"dependencies": {
"os-name": "^3.0.0"
"os-name": "^3.1.0"
},
"deprecated": false,
"description": "Get a user agent string in both browser and node",
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cypress": "^3.1.0",
"mocha": "^6.0.0",
"nyc": "^14.0.0",
"proxyquire": "^2.1.0",
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.6.0",
"@pika/plugin-ts-standard-pkg": "^0.6.0",
"@types/jest": "^24.0.18",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"semantic-release": "^15.9.15",
"sinon": "^7.2.4",
"sinon-chai": "^3.2.0",
"standard": "^13.0.1",
"test": "^0.6.0",
"travis-deploy-once": "^5.0.7"
"ts-jest": "^24.0.2",
"typescript": "^3.6.2"
},
"files": [
"dist-*/",
"bin/"
],
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"main": "dist-node/index.js",
"module": "dist-web/index.js",
"name": "universal-user-agent",
"pika": true,
"repository": {
"type": "git",
"url": "git+https://github.com/gr2m/universal-user-agent.git"
},
"scripts": {
"coverage": "nyc report --reporter=html && open coverage/index.html",
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
"pretest": "standard",
"semantic-release": "semantic-release",
"test": "nyc mocha \"test/*-test.js\"",
"test:browser": "cypress run --browser chrome",
"travis-deploy-once": "travis-deploy-once"
},
"standard": {
"globals": [
"describe",
"it",
"beforeEach",
"afterEach",
"expect"
]
},
"types": "index.d.ts",
"version": "3.0.0"
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "4.0.0"
}

View File

@ -1,57 +0,0 @@
// make tests run in both Node & Express
if (!global.cy) {
const chai = require('chai')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
chai.use(sinonChai)
global.expect = chai.expect
let sandbox
beforeEach(() => {
sandbox = sinon.createSandbox()
global.cy = {
stub: function () {
return sandbox.stub.apply(sandbox, arguments)
},
log () {
console.log.apply(console, arguments)
}
}
})
afterEach(() => {
sandbox.restore()
})
}
const getUserAgent = require('..')
describe('smoke', () => {
it('works', () => {
expect(getUserAgent()).to.be.a('string')
expect(getUserAgent().length).to.be.above(10)
})
if (!process.browser) { // test on node only
const proxyquire = require('proxyquire').noCallThru()
it('works around wmic error on Windows (#5)', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('Command failed: wmic os get Caption')
}
})
expect(getUserAgent()).to.equal('Windows <version undetectable>')
})
it('does not swallow unexpected errors', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('oops')
}
})
expect(getUserAgent).to.throw('oops')
})
}
})

View File

@ -1,39 +1,35 @@
{
"_args": [
[
"@octokit/request@5.0.2",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@octokit/request@5.0.2",
"_id": "@octokit/request@5.0.2",
"_from": "@octokit/request@^5.0.0",
"_id": "@octokit/request@5.1.0",
"_inBundle": false,
"_integrity": "sha512-z1BQr43g4kOL4ZrIVBMHwi68Yg9VbkRUyuAgqCp1rU3vbYa69+2gIld/+gHclw15bJWQnhqqyEb7h5a5EqgZ0A==",
"_integrity": "sha512-I15T9PwjFs4tbWyhtFU2Kq7WDPidYMvRB7spmxoQRZfxSmiqullG+Nz+KbSmpkfnlvHwTr1e31R5WReFRKMXjg==",
"_location": "/@octokit/request",
"_phantomChildren": {
"os-name": "3.1.0"
},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/request@5.0.2",
"raw": "@octokit/request@^5.0.0",
"name": "@octokit/request",
"escapedName": "@octokit%2frequest",
"scope": "@octokit",
"rawSpec": "5.0.2",
"rawSpec": "^5.0.0",
"saveSpec": null,
"fetchSpec": "5.0.2"
"fetchSpec": "^5.0.0"
},
"_requiredBy": [
"/@octokit/graphql",
"/@octokit/rest"
],
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.0.2.tgz",
"_spec": "5.0.2",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.1.0.tgz",
"_shasum": "5609dcc7b5323e529f29d535214383d9eaf0c05c",
"_spec": "@octokit/request@^5.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/graphql",
"bugs": {
"url": "https://github.com/octokit/request.js/issues"
},
"bundleDependencies": false,
"dependencies": {
"@octokit/endpoint": "^5.1.0",
"@octokit/request-error": "^1.0.1",
@ -41,21 +37,25 @@
"is-plain-object": "^3.0.0",
"node-fetch": "^2.3.0",
"once": "^1.4.0",
"universal-user-agent": "^3.0.0"
"universal-user-agent": "^4.0.0"
},
"deprecated": false,
"description": "Send parameterized requests to GitHubs APIs with sensible defaults in browsers and Node",
"devDependencies": {
"@pika/pack": "^0.4.0",
"@pika/plugin-build-node": "^0.5.1",
"@pika/plugin-build-web": "^0.5.1",
"@pika/plugin-ts-standard-pkg": "^0.5.1",
"@octokit/auth-app": "^2.1.2",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.6.0",
"@pika/plugin-build-web": "^0.6.0",
"@pika/plugin-ts-standard-pkg": "^0.6.0",
"@types/fetch-mock": "^7.2.4",
"@types/jest": "^24.0.12",
"@types/lolex": "^3.1.1",
"@types/node": "^12.0.3",
"@types/node-fetch": "^2.3.3",
"@types/once": "^1.4.0",
"fetch-mock": "^7.2.0",
"jest": "^24.7.1",
"lolex": "^4.2.0",
"prettier": "^1.17.0",
"semantic-release": "^15.10.5",
"semantic-release-plugin-update-version-in-files": "^1.0.0",
@ -88,5 +88,5 @@
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "5.0.2"
"version": "5.1.0"
}

View File

@ -1,7 +1,7 @@
module.exports = parseOptions
const { Deprecation } = require('deprecation')
const getUserAgent = require('universal-user-agent')
const { getUserAgent } = require('universal-user-agent')
const once = require('once')
const pkg = require('../package.json')

View File

@ -1,35 +0,0 @@
language: node_js
cache: npm
# Trigger a push build on master and greenkeeper branches + PRs build on every branches
# Avoid double build on PRs (See https://github.com/travis-ci/travis-ci/issues/1147)
branches:
only:
- master
- /^greenkeeper.*$/
stages:
- test
- name: release
if: branch = master AND type IN (push)
jobs:
include:
- stage: test
node_js: 12
script: npm run test
- node_js: 8
script: npm run test
- node_js: 10
env: Node 10 & coverage upload
script:
- npm run test
- npm run coverage:upload
- node_js: lts/*
env: browser tests
script: npm run test:browser
- stage: release
node_js: lts/*
env: semantic-release
script: npm run semantic-release

View File

@ -4,13 +4,13 @@
[![@latest](https://img.shields.io/npm/v/universal-user-agent.svg)](https://www.npmjs.com/package/universal-user-agent)
[![Build Status](https://travis-ci.com/gr2m/universal-user-agent.svg?branch=master)](https://travis-ci.com/gr2m/universal-user-agent)
[![Coverage Status](https://coveralls.io/repos/github/gr2m/universal-user-agent/badge.svg)](https://coveralls.io/github/gr2m/universal-user-agent)
[![Greenkeeper](https://badges.greenkeeper.io/gr2m/universal-user-agent.svg)](https://greenkeeper.io/)
```js
const getUserAgent = require('universal-user-agent')
const userAgent = getUserAgent()
const { getUserAgent } = require("universal-user-agent");
// or import { getUserAgent } from "universal-user-agent";
const userAgent = getUserAgent();
// userAgent will look like this
// in browser: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0"
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)

View File

@ -1,6 +0,0 @@
module.exports = getUserAgentBrowser
function getUserAgentBrowser () {
/* global navigator */
return navigator.userAgent
}

View File

@ -1,4 +0,0 @@
{
"integrationFolder": "test",
"video": false
}

View File

@ -0,0 +1,22 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var osName = _interopDefault(require('os-name'));
function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}
exports.getUserAgent = getUserAgent;
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/node.js"],"sourcesContent":["import osName from \"os-name\";\nexport function getUserAgent() {\n try {\n return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;\n }\n catch (error) {\n if (/wmic os get Caption/.test(error.message)) {\n return \"Windows <version undetectable>\";\n }\n throw error;\n }\n}\n"],"names":["getUserAgent","process","version","substr","osName","arch","error","test","message"],"mappings":";;;;;;;;AACO,SAASA,YAAT,GAAwB;MACvB;WACQ,WAAUC,OAAO,CAACC,OAAR,CAAgBC,MAAhB,CAAuB,CAAvB,CAA0B,KAAIC,MAAM,EAAG,KAAIH,OAAO,CAACI,IAAK,GAA1E;GADJ,CAGA,OAAOC,KAAP,EAAc;QACN,sBAAsBC,IAAtB,CAA2BD,KAAK,CAACE,OAAjC,CAAJ,EAA+C;aACpC,gCAAP;;;UAEEF,KAAN;;;;;;"}

View File

@ -0,0 +1,3 @@
export function getUserAgent() {
return navigator.userAgent;
}

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1,12 @@
import osName from "os-name";
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows <version undetectable>";
}
throw error;
}
}

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1 @@
export { getUserAgent } from "./node";

View File

@ -0,0 +1 @@
export declare function getUserAgent(): string;

View File

@ -0,0 +1,6 @@
function getUserAgent() {
return navigator.userAgent;
}
export { getUserAgent };
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["../dist-src/browser.js"],"sourcesContent":["export function getUserAgent() {\n return navigator.userAgent;\n}\n"],"names":[],"mappings":"AAAO,SAAS,YAAY,GAAG;IAC3B,OAAO,SAAS,CAAC,SAAS,CAAC;CAC9B;;;;"}

View File

@ -1 +0,0 @@
export default function getUserAgentNode(): string;

View File

@ -1,15 +0,0 @@
module.exports = getUserAgentNode
const osName = require('os-name')
function getUserAgentNode () {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`
} catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return 'Windows <version undetectable>'
}
throw error
}
}

View File

@ -1,85 +1,65 @@
{
"_args": [
[
"universal-user-agent@3.0.0",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "universal-user-agent@3.0.0",
"_id": "universal-user-agent@3.0.0",
"_from": "universal-user-agent@^4.0.0",
"_id": "universal-user-agent@4.0.0",
"_inBundle": false,
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
"_location": "/@octokit/rest/universal-user-agent",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "universal-user-agent@3.0.0",
"raw": "universal-user-agent@^4.0.0",
"name": "universal-user-agent",
"escapedName": "universal-user-agent",
"rawSpec": "3.0.0",
"rawSpec": "^4.0.0",
"saveSpec": null,
"fetchSpec": "3.0.0"
"fetchSpec": "^4.0.0"
},
"_requiredBy": [
"/@octokit/rest"
],
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
"_spec": "3.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
},
"browser": "browser.js",
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
"_shasum": "27da2ec87e32769619f68a14996465ea1cb9df16",
"_spec": "universal-user-agent@^4.0.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@octokit/rest",
"bugs": {
"url": "https://github.com/gr2m/universal-user-agent/issues"
},
"bundleDependencies": false,
"dependencies": {
"os-name": "^3.0.0"
"os-name": "^3.1.0"
},
"deprecated": false,
"description": "Get a user agent string in both browser and node",
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.2",
"cypress": "^3.1.0",
"mocha": "^6.0.0",
"nyc": "^14.0.0",
"proxyquire": "^2.1.0",
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
"@pika/pack": "^0.5.0",
"@pika/plugin-build-node": "^0.6.0",
"@pika/plugin-ts-standard-pkg": "^0.6.0",
"@types/jest": "^24.0.18",
"jest": "^24.9.0",
"prettier": "^1.18.2",
"semantic-release": "^15.9.15",
"sinon": "^7.2.4",
"sinon-chai": "^3.2.0",
"standard": "^13.0.1",
"test": "^0.6.0",
"travis-deploy-once": "^5.0.7"
"ts-jest": "^24.0.2",
"typescript": "^3.6.2"
},
"files": [
"dist-*/",
"bin/"
],
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"main": "dist-node/index.js",
"module": "dist-web/index.js",
"name": "universal-user-agent",
"pika": true,
"repository": {
"type": "git",
"url": "git+https://github.com/gr2m/universal-user-agent.git"
},
"scripts": {
"coverage": "nyc report --reporter=html && open coverage/index.html",
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
"pretest": "standard",
"semantic-release": "semantic-release",
"test": "nyc mocha \"test/*-test.js\"",
"test:browser": "cypress run --browser chrome",
"travis-deploy-once": "travis-deploy-once"
},
"standard": {
"globals": [
"describe",
"it",
"beforeEach",
"afterEach",
"expect"
]
},
"types": "index.d.ts",
"version": "3.0.0"
"sideEffects": false,
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"version": "4.0.0"
}

View File

@ -1,57 +0,0 @@
// make tests run in both Node & Express
if (!global.cy) {
const chai = require('chai')
const sinon = require('sinon')
const sinonChai = require('sinon-chai')
chai.use(sinonChai)
global.expect = chai.expect
let sandbox
beforeEach(() => {
sandbox = sinon.createSandbox()
global.cy = {
stub: function () {
return sandbox.stub.apply(sandbox, arguments)
},
log () {
console.log.apply(console, arguments)
}
}
})
afterEach(() => {
sandbox.restore()
})
}
const getUserAgent = require('..')
describe('smoke', () => {
it('works', () => {
expect(getUserAgent()).to.be.a('string')
expect(getUserAgent().length).to.be.above(10)
})
if (!process.browser) { // test on node only
const proxyquire = require('proxyquire').noCallThru()
it('works around wmic error on Windows (#5)', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('Command failed: wmic os get Caption')
}
})
expect(getUserAgent()).to.equal('Windows <version undetectable>')
})
it('does not swallow unexpected errors', () => {
const getUserAgent = proxyquire('..', {
'os-name': () => {
throw new Error('oops')
}
})
expect(getUserAgent).to.throw('oops')
})
}
})

View File

@ -1,35 +1,30 @@
{
"_args": [
[
"@octokit/rest@16.28.7",
"/Users/rachmari/github-repos/hello-world-javascript-action"
]
],
"_from": "@octokit/rest@16.28.7",
"_id": "@octokit/rest@16.28.7",
"_from": "@octokit/rest@^16.15.0",
"_id": "@octokit/rest@16.28.9",
"_inBundle": false,
"_integrity": "sha512-cznFSLEhh22XD3XeqJw51OLSfyL2fcFKUO+v2Ep9MTAFfFLS1cK1Zwd1yEgQJmJoDnj4/vv3+fGGZweG+xsbIA==",
"_integrity": "sha512-IKGnX+Tvzt7XHhs8f4ajqxyJvYAMNX5nWfoJm4CQj8LZToMiaJgutf5KxxpxoC3y5w7JTJpW5rnWnF4TsIvCLA==",
"_location": "/@octokit/rest",
"_phantomChildren": {
"os-name": "3.1.0"
},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@octokit/rest@16.28.7",
"raw": "@octokit/rest@^16.15.0",
"name": "@octokit/rest",
"escapedName": "@octokit%2frest",
"scope": "@octokit",
"rawSpec": "16.28.7",
"rawSpec": "^16.15.0",
"saveSpec": null,
"fetchSpec": "16.28.7"
"fetchSpec": "^16.15.0"
},
"_requiredBy": [
"/@actions/github"
],
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.7.tgz",
"_spec": "16.28.7",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action",
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.9.tgz",
"_shasum": "ac8c5f3ff305e9e0a0989a5245e4286f057a95d7",
"_spec": "@octokit/rest@^16.15.0",
"_where": "/Users/rachmari/github-repos/hello-world-javascript-action/node_modules/@actions/github",
"author": {
"name": "Gregor Martynus",
"url": "https://github.com/gr2m"
@ -37,6 +32,7 @@
"bugs": {
"url": "https://github.com/octokit/rest.js/issues"
},
"bundleDependencies": false,
"bundlesize": [
{
"path": "./dist/octokit-rest.min.js.gz",
@ -73,9 +69,9 @@
"lodash.uniq": "^4.5.0",
"octokit-pagination-methods": "^1.1.0",
"once": "^1.4.0",
"universal-user-agent": "^3.0.0",
"url-template": "^2.0.8"
"universal-user-agent": "^4.0.0"
},
"deprecated": false,
"description": "GitHub REST API client for Node.js",
"devDependencies": {
"@gimenete/type-writer": "^0.1.3",
@ -102,8 +98,8 @@
"semantic-release": "^15.0.0",
"sinon": "^7.2.4",
"sinon-chai": "^3.0.0",
"sort-keys": "^3.0.0",
"standard": "^13.0.1",
"sort-keys": "^4.0.0",
"standard": "^14.0.2",
"string-to-arraybuffer": "^1.0.0",
"string-to-jsdoc-comment": "^1.0.0",
"typescript": "^3.3.1",
@ -185,5 +181,5 @@
]
},
"types": "index.d.ts",
"version": "16.28.7"
"version": "16.28.9"
}

Some files were not shown because too many files have changed in this diff Show More