Skip to content

Commit

Permalink
Merge pull request #90 from peter-evans/update-distribution
Browse files Browse the repository at this point in the history
Update distribution
  • Loading branch information
peter-evans authored Nov 19, 2020
2 parents f29c35e + 6c5fc38 commit 72ab5a2
Showing 1 changed file with 91 additions and 78 deletions.
169 changes: 91 additions & 78 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1909,56 +1909,43 @@ var request = __webpack_require__(234);
var graphql = __webpack_require__(668);
var authToken = __webpack_require__(334);

function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;

for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}

return obj;
return target;
}

function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};

if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
var target = _objectWithoutPropertiesLoose(source, excluded);

return keys;
}
var key, i;

function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);

if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}

return target;
}

const VERSION = "3.1.2";
const VERSION = "3.2.1";

class Octokit {
constructor(options = {}) {
Expand Down Expand Up @@ -1990,17 +1977,15 @@ class Octokit {
}

this.request = request.request.defaults(requestDefaults);
this.graphql = graphql.withCustomRequest(this.request).defaults(_objectSpread2(_objectSpread2({}, requestDefaults), {}, {
baseUrl: requestDefaults.baseUrl.replace(/\/api\/v3$/, "/api")
}));
this.graphql = graphql.withCustomRequest(this.request).defaults(requestDefaults);
this.log = Object.assign({
debug: () => {},
info: () => {},
warn: console.warn.bind(console),
error: console.error.bind(console)
}, options.log);
this.hook = hook; // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.
// is unauthenticated. The `this.auth()` method is a no-op and no request hook is registered.
// (2) If only `options.auth` is set, use the default token authentication strategy.
// (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.
// TODO: type `options.auth` based on `options.authStrategy`.
Expand All @@ -2019,8 +2004,21 @@ class Octokit {
this.auth = auth;
}
} else {
const auth = options.authStrategy(Object.assign({
request: this.request
const {
authStrategy
} = options,
otherOptions = _objectWithoutProperties(options, ["authStrategy"]);

const auth = authStrategy(Object.assign({
request: this.request,
log: this.log,
// we pass the current octokit instance as well as its constructor options
// to allow for authentication strategies that return a new octokit instance
// that shares the same internal state as the current one. The original
// requirement for this was the "event-octokit" authentication strategy
// of https://github.com/probot/octokit-auth-probot.
octokit: this,
octokitOptions: otherOptions
}, options.auth)); // @ts-ignore ¯\_(ツ)_/¯

hook.wrap("request", auth.hook);
Expand Down Expand Up @@ -2117,6 +2115,16 @@ function mergeDeep(defaults, options) {
return result;
}

function removeUndefinedProperties(obj) {
for (const key in obj) {
if (obj[key] === undefined) {
delete obj[key];
}
}

return obj;
}

function merge(defaults, route, options) {
if (typeof route === "string") {
let [method, url] = route.split(" ");
Expand All @@ -2131,7 +2139,10 @@ function merge(defaults, route, options) {
} // lowercase header names before merging with defaults to avoid duplicates


options.headers = lowercaseKeys(options.headers);
options.headers = lowercaseKeys(options.headers); // remove properties with undefined values before merging

removeUndefinedProperties(options);
removeUndefinedProperties(options.headers);
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten

if (defaults && defaults.mediaType.previews.length) {
Expand Down Expand Up @@ -2353,7 +2364,7 @@ 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 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
Expand Down Expand Up @@ -2438,7 +2449,7 @@ function withDefaults(oldDefaults, newDefaults) {
});
}

const VERSION = "6.0.6";
const VERSION = "6.0.9";

const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.
// So we use RequestParameters and add method as additional required property.
Expand Down Expand Up @@ -2475,7 +2486,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
var request = __webpack_require__(234);
var universalUserAgent = __webpack_require__(429);

const VERSION = "4.5.6";
const VERSION = "4.5.7";

class GraphqlError extends Error {
constructor(request, response) {
Expand Down Expand Up @@ -2588,7 +2599,7 @@ exports.withCustomRequest = withCustomRequest;

Object.defineProperty(exports, "__esModule", ({ value: true }));

const VERSION = "2.4.0";
const VERSION = "2.6.0";

/**
* Some “list” response that can be paginated have a different response structure
Expand Down Expand Up @@ -2641,26 +2652,23 @@ function iterator(octokit, route, parameters) {
let url = options.url;
return {
[Symbol.asyncIterator]: () => ({
next() {
if (!url) {
return Promise.resolve({
done: true
});
}

return requestMethod({
async next() {
if (!url) return {
done: true
};
const response = await requestMethod({
method,
url,
headers
}).then(normalizePaginatedListResponse).then(response => {
// `response.headers.link` format:
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
// sets `url` to undefined if "next" URL is not present or `link` header is not set
url = ((response.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
return {
value: response
};
});
const normalizedResponse = normalizePaginatedListResponse(response); // `response.headers.link` format:
// '<https://api.github.com/users/aseemk/followers?page=2>; rel="next", <https://api.github.com/users/aseemk/followers?page=2>; rel="last"'
// sets `url` to undefined if "next" URL is not present or `link` header is not set

url = ((normalizedResponse.headers.link || "").match(/<([^>]+)>;\s*rel="next"/) || [])[1];
return {
value: normalizedResponse
};
}

})
Expand Down Expand Up @@ -2698,6 +2706,10 @@ function gather(octokit, results, iterator, mapFn) {
});
}

const composePaginateRest = Object.assign(paginate, {
iterator
});

/**
* @param octokit Octokit instance
* @param options Options passed to Octokit constructor
Expand All @@ -2712,6 +2724,7 @@ function paginateRest(octokit) {
}
paginateRest.VERSION = VERSION;

exports.composePaginateRest = composePaginateRest;
exports.paginateRest = paginateRest;
//# sourceMappingURL=index.js.map

Expand Down Expand Up @@ -3775,7 +3788,7 @@ const Endpoints = {
}
};

const VERSION = "4.2.0";
const VERSION = "4.2.1";

function endpointsToMethods(octokit, endpointsMap) {
const newMethods = {};
Expand Down Expand Up @@ -3959,7 +3972,7 @@ var isPlainObject = __webpack_require__(287);
var nodeFetch = _interopDefault(__webpack_require__(467));
var requestError = __webpack_require__(537);

const VERSION = "5.4.9";
const VERSION = "5.4.10";

function getBufferResponse(response) {
return response.arrayBuffer();
Expand Down Expand Up @@ -6413,103 +6426,103 @@ module.exports = eval("require")("encoding");
/***/ ((module) => {

"use strict";
module.exports = require("assert");
module.exports = require("assert");;

/***/ }),

/***/ 614:
/***/ ((module) => {

"use strict";
module.exports = require("events");
module.exports = require("events");;

/***/ }),

/***/ 747:
/***/ ((module) => {

"use strict";
module.exports = require("fs");
module.exports = require("fs");;

/***/ }),

/***/ 605:
/***/ ((module) => {

"use strict";
module.exports = require("http");
module.exports = require("http");;

/***/ }),

/***/ 211:
/***/ ((module) => {

"use strict";
module.exports = require("https");
module.exports = require("https");;

/***/ }),

/***/ 631:
/***/ ((module) => {

"use strict";
module.exports = require("net");
module.exports = require("net");;

/***/ }),

/***/ 87:
/***/ ((module) => {

"use strict";
module.exports = require("os");
module.exports = require("os");;

/***/ }),

/***/ 622:
/***/ ((module) => {

"use strict";
module.exports = require("path");
module.exports = require("path");;

/***/ }),

/***/ 413:
/***/ ((module) => {

"use strict";
module.exports = require("stream");
module.exports = require("stream");;

/***/ }),

/***/ 16:
/***/ ((module) => {

"use strict";
module.exports = require("tls");
module.exports = require("tls");;

/***/ }),

/***/ 835:
/***/ ((module) => {

"use strict";
module.exports = require("url");
module.exports = require("url");;

/***/ }),

/***/ 669:
/***/ ((module) => {

"use strict";
module.exports = require("util");
module.exports = require("util");;

/***/ }),

/***/ 761:
/***/ ((module) => {

"use strict";
module.exports = require("zlib");
module.exports = require("zlib");;

/***/ })

Expand Down

0 comments on commit 72ab5a2

Please sign in to comment.