Update modules
This commit is contained in:
parent
3804ea559b
commit
77a52a77ba
11
lib/main.js
11
lib/main.js
@ -1,9 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
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) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -22,13 +23,13 @@ function get_release_by_tag(tag, octokit, context) {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
core.debug(`Getting release by tag ${tag}.`);
|
core.debug(`Getting release by tag ${tag}.`);
|
||||||
return yield octokit.repos.getReleaseByTag(Object.assign({}, context.repo, { tag: tag }));
|
return yield octokit.repos.getReleaseByTag(Object.assign(Object.assign({}, context.repo), { tag: tag }));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
// If this returns 404, we need to create the release first.
|
// If this returns 404, we need to create the release first.
|
||||||
if (error.status === 404) {
|
if (error.status === 404) {
|
||||||
core.debug(`Release for tag ${tag} doesn't exist yet so we'll create it now.`);
|
core.debug(`Release for tag ${tag} doesn't exist yet so we'll create it now.`);
|
||||||
return yield octokit.repos.createRelease(Object.assign({}, context.repo, { tag_name: tag }));
|
return yield octokit.repos.createRelease(Object.assign(Object.assign({}, context.repo), { tag_name: tag }));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw error;
|
throw error;
|
||||||
@ -41,12 +42,12 @@ function upload_to_release(release, file, asset_name, tag, overwrite, octokit, c
|
|||||||
const file_size = fs.statSync(file).size;
|
const file_size = fs.statSync(file).size;
|
||||||
const file_bytes = fs.readFileSync(file);
|
const file_bytes = fs.readFileSync(file);
|
||||||
// Check for duplicates.
|
// Check for duplicates.
|
||||||
const assets = yield octokit.repos.listAssetsForRelease(Object.assign({}, context.repo, { release_id: release.data.id }));
|
const assets = yield octokit.repos.listAssetsForRelease(Object.assign(Object.assign({}, context.repo), { release_id: release.data.id }));
|
||||||
const duplicate_asset = assets.data.find(a => a.name === asset_name);
|
const duplicate_asset = assets.data.find(a => a.name === asset_name);
|
||||||
if (duplicate_asset !== undefined) {
|
if (duplicate_asset !== undefined) {
|
||||||
if (overwrite === "true") {
|
if (overwrite === "true") {
|
||||||
core.debug(`An asset called ${asset_name} already exists in release ${tag} so we'll overwrite it.`);
|
core.debug(`An asset called ${asset_name} already exists in release ${tag} so we'll overwrite it.`);
|
||||||
yield octokit.repos.deleteReleaseAsset(Object.assign({}, context.repo, { asset_id: duplicate_asset.id }));
|
yield octokit.repos.deleteReleaseAsset(Object.assign(Object.assign({}, context.repo), { asset_id: duplicate_asset.id }));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.setFailed(`An asset called ${asset_name} already exists.`);
|
core.setFailed(`An asset called ${asset_name} already exists.`);
|
||||||
|
7
node_modules/@actions/github/LICENSE.md
generated
vendored
7
node_modules/@actions/github/LICENSE.md
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
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.
|
|
14
node_modules/@actions/github/README.md
generated
vendored
14
node_modules/@actions/github/README.md
generated
vendored
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the API.
|
Returns an Octokit client. See https://octokit.github.io/rest.js for the API.
|
||||||
|
|
||||||
```
|
```js
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ const myToken = core.getInput('myToken');
|
|||||||
|
|
||||||
const octokit = new github.GitHub(myToken);
|
const octokit = new github.GitHub(myToken);
|
||||||
|
|
||||||
const pulls = await octokit.pulls.get({
|
const { data: pullRequest } = await octokit.pulls.get({
|
||||||
owner: 'octokit',
|
owner: 'octokit',
|
||||||
repo: 'rest.js',
|
repo: 'rest.js',
|
||||||
pull_number: 123,
|
pull_number: 123,
|
||||||
@ -24,18 +24,18 @@ const pulls = await octokit.pulls.get({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(pulls);
|
console.log(pullRequest);
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also make GraphQL requests:
|
You can also make GraphQL requests. See https://github.com/octokit/graphql.js for the API.
|
||||||
|
|
||||||
```
|
```js
|
||||||
const result = await octokit.graphql(query, variables);
|
const result = await octokit.graphql(query, variables);
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, you can get the context of the current action:
|
Finally, you can get the context of the current action:
|
||||||
|
|
||||||
```
|
```js
|
||||||
const github = require('@actions/github');
|
const github = require('@actions/github');
|
||||||
|
|
||||||
const context = github.context;
|
const context = github.context;
|
||||||
|
15
node_modules/@actions/github/lib/context.js
generated
vendored
15
node_modules/@actions/github/lib/context.js
generated
vendored
@ -1,14 +1,21 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
/* eslint-disable @typescript-eslint/no-require-imports */
|
const fs_1 = require("fs");
|
||||||
|
const os_1 = require("os");
|
||||||
class Context {
|
class Context {
|
||||||
/**
|
/**
|
||||||
* Hydrate the context from the environment
|
* Hydrate the context from the environment
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.payload = process.env.GITHUB_EVENT_PATH
|
this.payload = {};
|
||||||
? require(process.env.GITHUB_EVENT_PATH)
|
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.eventName = process.env.GITHUB_EVENT_NAME;
|
||||||
this.sha = process.env.GITHUB_SHA;
|
this.sha = process.env.GITHUB_SHA;
|
||||||
this.ref = process.env.GITHUB_REF;
|
this.ref = process.env.GITHUB_REF;
|
||||||
|
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
2
node_modules/@actions/github/lib/context.js.map
generated
vendored
@ -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,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;AAjED,0BAiEC"}
|
21
node_modules/@actions/github/package.json
generated
vendored
21
node_modules/@actions/github/package.json
generated
vendored
@ -1,32 +1,32 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"@actions/github@1.0.0",
|
"@actions/github@1.0.1",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "@actions/github@1.0.0",
|
"_from": "@actions/github@1.0.1",
|
||||||
"_id": "@actions/github@1.0.0",
|
"_id": "@actions/github@1.0.1",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-PPbWZ5wFAD/Vr+RCECfR3KNHjTwYln4liJBihs9tQUL0/PCFqB2lSkIh9V94AcZFHxgKk8snImjuLaBE8bKR7A==",
|
"_integrity": "sha512-fmji0JB0E4vmtXVjnqCJouLP4AyM/B5nbLe9U9ooPerxXh9r+VBlx8Lh5c+Dlvux1GooUduQxy4XVA21Lfs/Wg==",
|
||||||
"_location": "/@actions/github",
|
"_location": "/@actions/github",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@actions/github@1.0.0",
|
"raw": "@actions/github@1.0.1",
|
||||||
"name": "@actions/github",
|
"name": "@actions/github",
|
||||||
"escapedName": "@actions%2fgithub",
|
"escapedName": "@actions%2fgithub",
|
||||||
"scope": "@actions",
|
"scope": "@actions",
|
||||||
"rawSpec": "1.0.0",
|
"rawSpec": "1.0.1",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "1.0.0"
|
"fetchSpec": "1.0.1"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/"
|
"/"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-1.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/@actions/github/-/github-1.0.1.tgz",
|
||||||
"_spec": "1.0.0",
|
"_spec": "1.0.1",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
@ -46,7 +46,6 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"gitHead": "a40bce7c8d382aa3dbadaa327acbc696e9390e55",
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/github",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"github",
|
"github",
|
||||||
@ -67,5 +66,5 @@
|
|||||||
"test": "jest",
|
"test": "jest",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "1.0.0"
|
"version": "1.0.1"
|
||||||
}
|
}
|
||||||
|
196
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
196
node_modules/@octokit/endpoint/dist-node/index.js
generated
vendored
@ -4,10 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|||||||
|
|
||||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
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 isPlainObject = _interopDefault(require('is-plain-object'));
|
||||||
var urlTemplate = _interopDefault(require('url-template'));
|
var universalUserAgent = require('universal-user-agent');
|
||||||
var getUserAgent = _interopDefault(require('universal-user-agent'));
|
|
||||||
|
|
||||||
function lowercaseKeys(object) {
|
function lowercaseKeys(object) {
|
||||||
if (!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) {
|
function merge(defaults, route, options) {
|
||||||
if (typeof route === "string") {
|
if (typeof route === "string") {
|
||||||
let [method, url] = route.split(" ");
|
let [method, url] = route.split(" ");
|
||||||
@ -35,9 +49,7 @@ function merge(defaults, route, options) {
|
|||||||
|
|
||||||
|
|
||||||
options.headers = lowercaseKeys(options.headers);
|
options.headers = lowercaseKeys(options.headers);
|
||||||
const mergedOptions = deepmerge.all([defaults, options].filter(Boolean), {
|
const mergedOptions = mergeDeep(defaults || {}, options); // mediaType.previews arrays are merged, instead of overwritten
|
||||||
isMergeableObject: isPlainObject
|
|
||||||
}); // mediaType.previews arrays are merged, instead of overwritten
|
|
||||||
|
|
||||||
if (defaults && defaults.mediaType.previews.length) {
|
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 = 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) {
|
function parse(options) {
|
||||||
// https://fetch.spec.whatwg.org/#methods
|
// https://fetch.spec.whatwg.org/#methods
|
||||||
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
|
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
|
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
|
||||||
|
|
||||||
const urlVariableNames = extractUrlVariableNames(url);
|
const urlVariableNames = extractUrlVariableNames(url);
|
||||||
url = urlTemplate.parse(url).expand(parameters);
|
url = parseUrl(url).expand(parameters);
|
||||||
|
|
||||||
if (!/^http/.test(url)) {
|
if (!/^http/.test(url)) {
|
||||||
url = options.baseUrl + url;
|
url = options.baseUrl + url;
|
||||||
@ -178,7 +357,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|||||||
|
|
||||||
const VERSION = "0.0.0-development";
|
const VERSION = "0.0.0-development";
|
||||||
|
|
||||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`;
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
baseUrl: "https://api.github.com",
|
baseUrl: "https://api.github.com",
|
||||||
@ -195,3 +374,4 @@ const DEFAULTS = {
|
|||||||
const endpoint = withDefaults(null, DEFAULTS);
|
const endpoint = withDefaults(null, DEFAULTS);
|
||||||
|
|
||||||
exports.endpoint = endpoint;
|
exports.endpoint = endpoint;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
|
1
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-node/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
2
node_modules/@octokit/endpoint/dist-src/defaults.js
generated
vendored
@ -1,4 +1,4 @@
|
|||||||
import getUserAgent from "universal-user-agent";
|
import { getUserAgent } from "universal-user-agent";
|
||||||
import { VERSION } from "./version";
|
import { VERSION } from "./version";
|
||||||
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||||
export const DEFAULTS = {
|
export const DEFAULTS = {
|
||||||
|
7
node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
7
node_modules/@octokit/endpoint/dist-src/merge.js
generated
vendored
@ -1,6 +1,5 @@
|
|||||||
import deepmerge from "deepmerge";
|
|
||||||
import isPlainObject from "is-plain-object";
|
|
||||||
import { lowercaseKeys } from "./util/lowercase-keys";
|
import { lowercaseKeys } from "./util/lowercase-keys";
|
||||||
|
import { mergeDeep } from "./util/merge-deep";
|
||||||
export function merge(defaults, route, options) {
|
export function merge(defaults, route, options) {
|
||||||
if (typeof route === "string") {
|
if (typeof route === "string") {
|
||||||
let [method, url] = route.split(" ");
|
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
|
// lowercase header names before merging with defaults to avoid duplicates
|
||||||
options.headers = lowercaseKeys(options.headers);
|
options.headers = lowercaseKeys(options.headers);
|
||||||
const mergedOptions = deepmerge.all([defaults, options].filter(Boolean), {
|
const mergedOptions = mergeDeep(defaults || {}, options);
|
||||||
isMergeableObject: isPlainObject
|
|
||||||
});
|
|
||||||
// mediaType.previews arrays are merged, instead of overwritten
|
// mediaType.previews arrays are merged, instead of overwritten
|
||||||
if (defaults && defaults.mediaType.previews.length) {
|
if (defaults && defaults.mediaType.previews.length) {
|
||||||
mergedOptions.mediaType.previews = defaults.mediaType.previews
|
mergedOptions.mediaType.previews = defaults.mediaType.previews
|
||||||
|
4
node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
4
node_modules/@octokit/endpoint/dist-src/parse.js
generated
vendored
@ -1,7 +1,7 @@
|
|||||||
import urlTemplate from "url-template";
|
|
||||||
import { addQueryParameters } from "./util/add-query-parameters";
|
import { addQueryParameters } from "./util/add-query-parameters";
|
||||||
import { extractUrlVariableNames } from "./util/extract-url-variable-names";
|
import { extractUrlVariableNames } from "./util/extract-url-variable-names";
|
||||||
import { omit } from "./util/omit";
|
import { omit } from "./util/omit";
|
||||||
|
import { parseUrl } from "./util/url-template";
|
||||||
export function parse(options) {
|
export function parse(options) {
|
||||||
// https://fetch.spec.whatwg.org/#methods
|
// https://fetch.spec.whatwg.org/#methods
|
||||||
let method = options.method.toUpperCase();
|
let method = options.method.toUpperCase();
|
||||||
@ -19,7 +19,7 @@ export function parse(options) {
|
|||||||
]);
|
]);
|
||||||
// extract variable names from URL to calculate remaining variables later
|
// extract variable names from URL to calculate remaining variables later
|
||||||
const urlVariableNames = extractUrlVariableNames(url);
|
const urlVariableNames = extractUrlVariableNames(url);
|
||||||
url = urlTemplate.parse(url).expand(parameters);
|
url = parseUrl(url).expand(parameters);
|
||||||
if (!/^http/.test(url)) {
|
if (!/^http/.test(url)) {
|
||||||
url = options.baseUrl + url;
|
url = options.baseUrl + url;
|
||||||
}
|
}
|
||||||
|
16
node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal file
16
node_modules/@octokit/endpoint/dist-src/util/merge-deep.js
generated
vendored
Normal 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;
|
||||||
|
}
|
170
node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal file
170
node_modules/@octokit/endpoint/dist-src/util/url-template.js
generated
vendored
Normal 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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
4
node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
4
node_modules/@octokit/endpoint/dist-types/util/lowercase-keys.d.ts
generated
vendored
@ -1,3 +1,5 @@
|
|||||||
export declare function lowercaseKeys(object?: {
|
export declare function lowercaseKeys(object?: {
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
}): {};
|
}): {
|
||||||
|
[key: string]: any;
|
||||||
|
};
|
||||||
|
1
node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/dist-types/util/merge-deep.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function mergeDeep(defaults: any, options: any): object;
|
3
node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
3
node_modules/@octokit/endpoint/dist-types/util/url-template.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export declare function parseUrl(template: string): {
|
||||||
|
expand: (context: object) => string;
|
||||||
|
};
|
384
node_modules/@octokit/endpoint/dist-web/index.js
generated
vendored
384
node_modules/@octokit/endpoint/dist-web/index.js
generated
vendored
@ -1,200 +1,343 @@
|
|||||||
import deepmerge from 'deepmerge';
|
|
||||||
import isPlainObject from 'is-plain-object';
|
import isPlainObject from 'is-plain-object';
|
||||||
import urlTemplate from 'url-template';
|
import { getUserAgent } from 'universal-user-agent';
|
||||||
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");
|
|
||||||
}
|
|
||||||
|
|
||||||
function lowercaseKeys(object) {
|
function lowercaseKeys(object) {
|
||||||
if (!object) {
|
if (!object) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.keys(object).reduce((newObj, key) => {
|
return Object.keys(object).reduce((newObj, key) => {
|
||||||
newObj[key.toLowerCase()] = object[key];
|
newObj[key.toLowerCase()] = object[key];
|
||||||
return newObj;
|
return newObj;
|
||||||
}, {});
|
}, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
function merge(defaults, route, options) {
|
function mergeDeep(defaults, options) {
|
||||||
if (typeof route === "string") {
|
const result = Object.assign({}, defaults);
|
||||||
let _route$split = route.split(" "),
|
Object.keys(options).forEach(key => {
|
||||||
_route$split2 = _slicedToArray(_route$split, 2),
|
if (isPlainObject(options[key])) {
|
||||||
method = _route$split2[0],
|
if (!(key in defaults))
|
||||||
url = _route$split2[1];
|
Object.assign(result, { [key]: options[key] });
|
||||||
|
else
|
||||||
options = Object.assign(url ? {
|
result[key] = mergeDeep(defaults[key], options[key]);
|
||||||
method,
|
}
|
||||||
url
|
else {
|
||||||
} : {
|
Object.assign(result, { [key]: options[key] });
|
||||||
url: method
|
}
|
||||||
}, options);
|
});
|
||||||
} else {
|
return result;
|
||||||
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/, ""));
|
function merge(defaults, route, options) {
|
||||||
|
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;
|
return mergedOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addQueryParameters(url, parameters) {
|
function addQueryParameters(url, parameters) {
|
||||||
const separator = /\?/.test(url) ? "&" : "?";
|
const separator = /\?/.test(url) ? "&" : "?";
|
||||||
const names = Object.keys(parameters);
|
const names = Object.keys(parameters);
|
||||||
|
|
||||||
if (names.length === 0) {
|
if (names.length === 0) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
return (url +
|
||||||
return url + separator + names.map(name => {
|
separator +
|
||||||
|
names
|
||||||
|
.map(name => {
|
||||||
if (name === "q") {
|
if (name === "q") {
|
||||||
return "q=" + parameters.q.split("+").map(encodeURIComponent).join("+");
|
return ("q=" +
|
||||||
|
parameters
|
||||||
|
.q.split("+")
|
||||||
|
.map(encodeURIComponent)
|
||||||
|
.join("+"));
|
||||||
}
|
}
|
||||||
|
return `${name}=${encodeURIComponent(parameters[name])}`;
|
||||||
return "".concat(name, "=").concat(encodeURIComponent(parameters[name]));
|
})
|
||||||
}).join("&");
|
.join("&"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const urlVariableRegex = /\{[^}]+\}/g;
|
const urlVariableRegex = /\{[^}]+\}/g;
|
||||||
|
|
||||||
function removeNonChars(variableName) {
|
function removeNonChars(variableName) {
|
||||||
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
||||||
}
|
}
|
||||||
|
|
||||||
function extractUrlVariableNames(url) {
|
function extractUrlVariableNames(url) {
|
||||||
const matches = url.match(urlVariableRegex);
|
const matches = url.match(urlVariableRegex);
|
||||||
|
|
||||||
if (!matches) {
|
if (!matches) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
return matches.map(removeNonChars).reduce((a, b) => a.concat(b), []);
|
||||||
}
|
}
|
||||||
|
|
||||||
function omit(object, keysToOmit) {
|
function omit(object, keysToOmit) {
|
||||||
return Object.keys(object).filter(option => !keysToOmit.includes(option)).reduce((obj, key) => {
|
return Object.keys(object)
|
||||||
|
.filter(option => !keysToOmit.includes(option))
|
||||||
|
.reduce((obj, key) => {
|
||||||
obj[key] = object[key];
|
obj[key] = object[key];
|
||||||
return obj;
|
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) {
|
function parse(options) {
|
||||||
// https://fetch.spec.whatwg.org/#methods
|
// https://fetch.spec.whatwg.org/#methods
|
||||||
let method = options.method.toUpperCase(); // replace :varname with {varname} to make it RFC 6570 compatible
|
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 headers = Object.assign({}, options.headers);
|
||||||
let body;
|
let body;
|
||||||
let parameters = omit(options, ["method", "baseUrl", "url", "headers", "request", "mediaType"]); // extract variable names from URL to calculate remaining variables later
|
let parameters = omit(options, [
|
||||||
|
"method",
|
||||||
|
"baseUrl",
|
||||||
|
"url",
|
||||||
|
"headers",
|
||||||
|
"request",
|
||||||
|
"mediaType"
|
||||||
|
]);
|
||||||
|
// extract variable names from URL to calculate remaining variables later
|
||||||
const urlVariableNames = extractUrlVariableNames(url);
|
const urlVariableNames = extractUrlVariableNames(url);
|
||||||
url = urlTemplate.parse(url).expand(parameters);
|
url = parseUrl(url).expand(parameters);
|
||||||
|
|
||||||
if (!/^http/.test(url)) {
|
if (!/^http/.test(url)) {
|
||||||
url = options.baseUrl + url;
|
url = options.baseUrl + url;
|
||||||
}
|
}
|
||||||
|
const omittedParameters = Object.keys(options)
|
||||||
const omittedParameters = Object.keys(options).filter(option => urlVariableNames.includes(option)).concat("baseUrl");
|
.filter(option => urlVariableNames.includes(option))
|
||||||
|
.concat("baseUrl");
|
||||||
const remainingParameters = omit(parameters, omittedParameters);
|
const remainingParameters = omit(parameters, omittedParameters);
|
||||||
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
|
const isBinaryRequset = /application\/octet-stream/i.test(headers.accept);
|
||||||
|
|
||||||
if (!isBinaryRequset) {
|
if (!isBinaryRequset) {
|
||||||
if (options.mediaType.format) {
|
if (options.mediaType.format) {
|
||||||
// e.g. application/vnd.github.v3+json => application/vnd.github.v3.raw
|
// 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(",");
|
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) {
|
if (options.mediaType.previews.length) {
|
||||||
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
|
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
|
||||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map(preview => {
|
headers.accept = previewsFromAcceptHeader
|
||||||
const format = options.mediaType.format ? ".".concat(options.mediaType.format) : "+json";
|
.concat(options.mediaType.previews)
|
||||||
return "application/vnd.github.".concat(preview, "-preview").concat(format);
|
.map(preview => {
|
||||||
}).join(",");
|
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 GET/HEAD requests, set URL query parameters from remaining parameters
|
||||||
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
|
// for PATCH/POST/PUT/DELETE requests, set request body from remaining parameters
|
||||||
|
|
||||||
|
|
||||||
if (["GET", "HEAD"].includes(method)) {
|
if (["GET", "HEAD"].includes(method)) {
|
||||||
url = addQueryParameters(url, remainingParameters);
|
url = addQueryParameters(url, remainingParameters);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if ("data" in remainingParameters) {
|
if ("data" in remainingParameters) {
|
||||||
body = remainingParameters.data;
|
body = remainingParameters.data;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (Object.keys(remainingParameters).length) {
|
if (Object.keys(remainingParameters).length) {
|
||||||
body = remainingParameters;
|
body = remainingParameters;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
headers["content-length"] = 0;
|
headers["content-length"] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // default content-type for JSON if body is set
|
}
|
||||||
|
// default content-type for JSON if body is set
|
||||||
|
|
||||||
if (!headers["content-type"] && typeof body !== "undefined") {
|
if (!headers["content-type"] && typeof body !== "undefined") {
|
||||||
headers["content-type"] = "application/json; charset=utf-8";
|
headers["content-type"] = "application/json; charset=utf-8";
|
||||||
} // GitHub expects 'content-length: 0' header for PUT/PATCH requests without body.
|
}
|
||||||
|
// 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
|
// 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") {
|
if (["PATCH", "PUT"].includes(method) && typeof body === "undefined") {
|
||||||
body = "";
|
body = "";
|
||||||
} // Only return body/request keys if present
|
}
|
||||||
|
// Only return body/request keys if present
|
||||||
|
return Object.assign({ method, url, headers }, typeof body !== "undefined" ? { body } : null, options.request ? { request: options.request } : null);
|
||||||
return Object.assign({
|
|
||||||
method,
|
|
||||||
url,
|
|
||||||
headers
|
|
||||||
}, typeof body !== "undefined" ? {
|
|
||||||
body
|
|
||||||
} : null, options.request ? {
|
|
||||||
request: options.request
|
|
||||||
} : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function endpointWithDefaults(defaults, route, options) {
|
function endpointWithDefaults(defaults, route, options) {
|
||||||
@ -214,7 +357,7 @@ function withDefaults(oldDefaults, newDefaults) {
|
|||||||
|
|
||||||
const VERSION = "0.0.0-development";
|
const VERSION = "0.0.0-development";
|
||||||
|
|
||||||
const userAgent = "octokit-endpoint.js/".concat(VERSION, " ").concat(getUserAgent());
|
const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
baseUrl: "https://api.github.com",
|
baseUrl: "https://api.github.com",
|
||||||
@ -231,3 +374,4 @@ const DEFAULTS = {
|
|||||||
const endpoint = withDefaults(null, DEFAULTS);
|
const endpoint = withDefaults(null, DEFAULTS);
|
||||||
|
|
||||||
export { endpoint };
|
export { endpoint };
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
|
1
node_modules/@octokit/endpoint/dist-web/index.js.map
generated
vendored
Normal file
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
35
node_modules/@octokit/endpoint/node_modules/universal-user-agent/.travis.yml
generated
vendored
35
node_modules/@octokit/endpoint/node_modules/universal-user-agent/.travis.yml
generated
vendored
@ -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
|
|
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/README.md
generated
vendored
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/README.md
generated
vendored
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
[](https://www.npmjs.com/package/universal-user-agent)
|
[](https://www.npmjs.com/package/universal-user-agent)
|
||||||
[](https://travis-ci.com/gr2m/universal-user-agent)
|
[](https://travis-ci.com/gr2m/universal-user-agent)
|
||||||
[](https://coveralls.io/github/gr2m/universal-user-agent)
|
|
||||||
[](https://greenkeeper.io/)
|
[](https://greenkeeper.io/)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const getUserAgent = require('universal-user-agent')
|
const { getUserAgent } = require("universal-user-agent");
|
||||||
const userAgent = getUserAgent()
|
// or import { getUserAgent } from "universal-user-agent";
|
||||||
|
|
||||||
|
const userAgent = getUserAgent();
|
||||||
// userAgent will look like this
|
// 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 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)
|
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)
|
||||||
|
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/browser.js
generated
vendored
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/browser.js
generated
vendored
@ -1,6 +0,0 @@
|
|||||||
module.exports = getUserAgentBrowser
|
|
||||||
|
|
||||||
function getUserAgentBrowser () {
|
|
||||||
/* global navigator */
|
|
||||||
return navigator.userAgent
|
|
||||||
}
|
|
4
node_modules/@octokit/endpoint/node_modules/universal-user-agent/cypress.json
generated
vendored
4
node_modules/@octokit/endpoint/node_modules/universal-user-agent/cypress.json
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"integrationFolder": "test",
|
|
||||||
"video": false
|
|
||||||
}
|
|
22
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal file
22
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal 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
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal 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;;;;;;"}
|
3
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
3
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
12
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal file
12
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
6
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getUserAgent };
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal 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;;;;"}
|
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/index.d.ts
generated
vendored
1
node_modules/@octokit/endpoint/node_modules/universal-user-agent/index.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export default function getUserAgentNode(): string;
|
|
15
node_modules/@octokit/endpoint/node_modules/universal-user-agent/index.js
generated
vendored
15
node_modules/@octokit/endpoint/node_modules/universal-user-agent/index.js
generated
vendored
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
77
node_modules/@octokit/endpoint/node_modules/universal-user-agent/package.json
generated
vendored
77
node_modules/@octokit/endpoint/node_modules/universal-user-agent/package.json
generated
vendored
@ -1,85 +1,68 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"universal-user-agent@3.0.0",
|
"universal-user-agent@4.0.0",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "universal-user-agent@3.0.0",
|
"_from": "universal-user-agent@4.0.0",
|
||||||
"_id": "universal-user-agent@3.0.0",
|
"_id": "universal-user-agent@4.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
|
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
"_location": "/@octokit/endpoint/universal-user-agent",
|
"_location": "/@octokit/endpoint/universal-user-agent",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "universal-user-agent@3.0.0",
|
"raw": "universal-user-agent@4.0.0",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
"escapedName": "universal-user-agent",
|
"escapedName": "universal-user-agent",
|
||||||
"rawSpec": "3.0.0",
|
"rawSpec": "4.0.0",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "3.0.0"
|
"fetchSpec": "4.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@octokit/endpoint"
|
"/@octokit/endpoint"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
"_spec": "3.0.0",
|
"_spec": "4.0.0",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"author": {
|
|
||||||
"name": "Gregor Martynus",
|
|
||||||
"url": "https://github.com/gr2m"
|
|
||||||
},
|
|
||||||
"browser": "browser.js",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"os-name": "^3.0.0"
|
"os-name": "^3.1.0"
|
||||||
},
|
},
|
||||||
"description": "Get a user agent string in both browser and node",
|
"description": "Get a user agent string in both browser and node",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.1.2",
|
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
|
||||||
"coveralls": "^3.0.2",
|
"@pika/pack": "^0.5.0",
|
||||||
"cypress": "^3.1.0",
|
"@pika/plugin-build-node": "^0.6.0",
|
||||||
"mocha": "^6.0.0",
|
"@pika/plugin-ts-standard-pkg": "^0.6.0",
|
||||||
"nyc": "^14.0.0",
|
"@types/jest": "^24.0.18",
|
||||||
"proxyquire": "^2.1.0",
|
"jest": "^24.9.0",
|
||||||
|
"prettier": "^1.18.2",
|
||||||
"semantic-release": "^15.9.15",
|
"semantic-release": "^15.9.15",
|
||||||
"sinon": "^7.2.4",
|
"ts-jest": "^24.0.2",
|
||||||
"sinon-chai": "^3.2.0",
|
"typescript": "^3.6.2"
|
||||||
"standard": "^13.0.1",
|
|
||||||
"test": "^0.6.0",
|
|
||||||
"travis-deploy-once": "^5.0.7"
|
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"dist-*/",
|
||||||
|
"bin/"
|
||||||
|
],
|
||||||
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "index.js",
|
"main": "dist-node/index.js",
|
||||||
|
"module": "dist-web/index.js",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
|
"pika": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"sideEffects": false,
|
||||||
"coverage": "nyc report --reporter=html && open coverage/index.html",
|
"source": "dist-src/index.js",
|
||||||
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
|
"types": "dist-types/index.d.ts",
|
||||||
"pretest": "standard",
|
"version": "4.0.0"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
|
57
node_modules/@octokit/endpoint/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
57
node_modules/@octokit/endpoint/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
@ -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')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
35
node_modules/@octokit/endpoint/package.json
generated
vendored
35
node_modules/@octokit/endpoint/package.json
generated
vendored
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"@octokit/endpoint@5.3.2",
|
"@octokit/endpoint@5.3.5",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "@octokit/endpoint@5.3.2",
|
"_from": "@octokit/endpoint@5.3.5",
|
||||||
"_id": "@octokit/endpoint@5.3.2",
|
"_id": "@octokit/endpoint@5.3.5",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-gRjteEM9I6f4D8vtwU2iGUTn9RX/AJ0SVXiqBUEuYEWVGGAVjSXdT0oNmghH5lvQNWs8mwt6ZaultuG6yXivNw==",
|
"_integrity": "sha512-f8KqzIrnzPLiezDsZZPB+K8v8YSv6aKFl7eOu59O46lmlW4HagWl1U6NWl6LmT8d1w7NsKBI3paVtzcnRGO1gw==",
|
||||||
"_location": "/@octokit/endpoint",
|
"_location": "/@octokit/endpoint",
|
||||||
"_phantomChildren": {
|
"_phantomChildren": {
|
||||||
"os-name": "3.1.0"
|
"os-name": "3.1.0"
|
||||||
@ -16,43 +16,38 @@
|
|||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@octokit/endpoint@5.3.2",
|
"raw": "@octokit/endpoint@5.3.5",
|
||||||
"name": "@octokit/endpoint",
|
"name": "@octokit/endpoint",
|
||||||
"escapedName": "@octokit%2fendpoint",
|
"escapedName": "@octokit%2fendpoint",
|
||||||
"scope": "@octokit",
|
"scope": "@octokit",
|
||||||
"rawSpec": "5.3.2",
|
"rawSpec": "5.3.5",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "5.3.2"
|
"fetchSpec": "5.3.5"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@octokit/request"
|
"/@octokit/request"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.2.tgz",
|
"_resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-5.3.5.tgz",
|
||||||
"_spec": "5.3.2",
|
"_spec": "5.3.5",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/octokit/endpoint.js/issues"
|
"url": "https://github.com/octokit/endpoint.js/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deepmerge": "4.0.0",
|
|
||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"universal-user-agent": "^3.0.0",
|
"universal-user-agent": "^4.0.0"
|
||||||
"url-template": "^2.0.8"
|
|
||||||
},
|
},
|
||||||
"description": "Turns REST API endpoints into generic request options",
|
"description": "Turns REST API endpoints into generic request options",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/routes": "20.9.2",
|
"@octokit/routes": "20.9.2",
|
||||||
"@pika/pack": "^0.4.0",
|
"@pika/pack": "^0.5.0",
|
||||||
"@pika/plugin-build-node": "^0.4.0",
|
"@pika/plugin-build-node": "^0.6.0",
|
||||||
"@pika/plugin-build-web": "^0.4.0",
|
"@pika/plugin-build-web": "^0.6.0",
|
||||||
"@pika/plugin-ts-standard-pkg": "^0.4.0",
|
"@pika/plugin-ts-standard-pkg": "^0.6.0",
|
||||||
"@types/jest": "^24.0.11",
|
"@types/jest": "^24.0.11",
|
||||||
"@types/url-template": "^2.0.28",
|
|
||||||
"glob": "^7.1.3",
|
|
||||||
"handlebars": "^4.1.2",
|
"handlebars": "^4.1.2",
|
||||||
"jest": "^24.7.1",
|
"jest": "^24.7.1",
|
||||||
"lodash.set": "^4.3.2",
|
"lodash.set": "^4.3.2",
|
||||||
"nyc": "^14.0.0",
|
|
||||||
"pascal-case": "^2.0.1",
|
"pascal-case": "^2.0.1",
|
||||||
"prettier": "1.18.2",
|
"prettier": "1.18.2",
|
||||||
"semantic-release": "^15.13.8",
|
"semantic-release": "^15.13.8",
|
||||||
@ -87,5 +82,5 @@
|
|||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"source": "dist-src/index.js",
|
"source": "dist-src/index.js",
|
||||||
"types": "dist-types/index.d.ts",
|
"types": "dist-types/index.d.ts",
|
||||||
"version": "5.3.2"
|
"version": "5.3.5"
|
||||||
}
|
}
|
||||||
|
57
node_modules/@octokit/request/README.md
generated
vendored
57
node_modules/@octokit/request/README.md
generated
vendored
@ -42,13 +42,17 @@ request("POST /repos/:owner/:repo/issues/:number/labels", {
|
|||||||
mediaType: {
|
mediaType: {
|
||||||
previews: ["symmetra"]
|
previews: ["symmetra"]
|
||||||
},
|
},
|
||||||
owner: "ocotkit",
|
owner: "octokit",
|
||||||
repo: "request.js",
|
repo: "request.js",
|
||||||
number: 1,
|
number: 1,
|
||||||
labels: ["🐛 bug"]
|
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
|
👍 Sensible defaults
|
||||||
|
|
||||||
- `baseUrl`: `https://api.github.com`
|
- `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).
|
🧐 Simple to debug: Sets `error.request` to request options causing the error (with redacted credentials).
|
||||||
|
|
||||||
👶 Small bundle size (\<5kb minified + gzipped)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
@ -110,6 +112,8 @@ console.log(`${result.data.length} repos found.`);
|
|||||||
|
|
||||||
### GraphQL example
|
### GraphQL example
|
||||||
|
|
||||||
|
For GraphQL request we recommend using [`@octokit/graphql`](https://github.com/octokit/graphql.js#readme)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const result = await request("POST /graphql", {
|
const result = await request("POST /graphql", {
|
||||||
headers: {
|
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()
|
||||||
|
|
||||||
`request(route, options)` or `request(options)`.
|
`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:
|
All of the [`@octokit/endpoint`](https://github.com/octokit/endpoint.js) API can be used:
|
||||||
|
|
||||||
- [`ocotkitRequest.endpoint()`](#endpoint)
|
- [`octokitRequest.endpoint()`](#endpoint)
|
||||||
- [`ocotkitRequest.endpoint.defaults()`](#endpointdefaults)
|
- [`octokitRequest.endpoint.defaults()`](#endpointdefaults)
|
||||||
- [`ocotkitRequest.endpoint.merge()`](#endpointdefaults)
|
- [`octokitRequest.endpoint.merge()`](#endpointdefaults)
|
||||||
- [`ocotkitRequest.endpoint.parse()`](#endpointmerge)
|
- [`octokitRequest.endpoint.parse()`](#endpointmerge)
|
||||||
|
|
||||||
## Special cases
|
## Special cases
|
||||||
|
|
||||||
|
5
node_modules/@octokit/request/dist-node/index.js
generated
vendored
5
node_modules/@octokit/request/dist-node/index.js
generated
vendored
@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|||||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||||
|
|
||||||
var endpoint = require('@octokit/endpoint');
|
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 isPlainObject = _interopDefault(require('is-plain-object'));
|
||||||
var nodeFetch = _interopDefault(require('node-fetch'));
|
var nodeFetch = _interopDefault(require('node-fetch'));
|
||||||
var requestError = require('@octokit/request-error');
|
var requestError = require('@octokit/request-error');
|
||||||
@ -136,8 +136,9 @@ function withDefaults(oldEndpoint, newDefaults) {
|
|||||||
|
|
||||||
const request = withDefaults(endpoint.endpoint, {
|
const request = withDefaults(endpoint.endpoint, {
|
||||||
headers: {
|
headers: {
|
||||||
"user-agent": `octokit-request.js/${VERSION} ${getUserAgent()}`
|
"user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.request = request;
|
exports.request = request;
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
|
1
node_modules/@octokit/request/dist-node/index.js.map
generated
vendored
Normal file
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
2
node_modules/@octokit/request/dist-src/index.js
generated
vendored
2
node_modules/@octokit/request/dist-src/index.js
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
import { endpoint } from "@octokit/endpoint";
|
import { endpoint } from "@octokit/endpoint";
|
||||||
import getUserAgent from "universal-user-agent";
|
import { getUserAgent } from "universal-user-agent";
|
||||||
import { VERSION } from "./version";
|
import { VERSION } from "./version";
|
||||||
import withDefaults from "./with-defaults";
|
import withDefaults from "./with-defaults";
|
||||||
export const request = withDefaults(endpoint, {
|
export const request = withDefaults(endpoint, {
|
||||||
|
3
node_modules/@octokit/request/dist-web/index.js
generated
vendored
3
node_modules/@octokit/request/dist-web/index.js
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
import { endpoint } from '@octokit/endpoint';
|
import { endpoint } from '@octokit/endpoint';
|
||||||
import getUserAgent from 'universal-user-agent';
|
import { getUserAgent } from 'universal-user-agent';
|
||||||
import isPlainObject from 'is-plain-object';
|
import isPlainObject from 'is-plain-object';
|
||||||
import nodeFetch from 'node-fetch';
|
import nodeFetch from 'node-fetch';
|
||||||
import { RequestError } from '@octokit/request-error';
|
import { RequestError } from '@octokit/request-error';
|
||||||
@ -124,3 +124,4 @@ const request = withDefaults(endpoint, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
export { request };
|
export { request };
|
||||||
|
//# sourceMappingURL=index.js.map
|
||||||
|
1
node_modules/@octokit/request/dist-web/index.js.map
generated
vendored
Normal file
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
35
node_modules/@octokit/request/node_modules/universal-user-agent/.travis.yml
generated
vendored
35
node_modules/@octokit/request/node_modules/universal-user-agent/.travis.yml
generated
vendored
@ -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
|
|
6
node_modules/@octokit/request/node_modules/universal-user-agent/README.md
generated
vendored
6
node_modules/@octokit/request/node_modules/universal-user-agent/README.md
generated
vendored
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
[](https://www.npmjs.com/package/universal-user-agent)
|
[](https://www.npmjs.com/package/universal-user-agent)
|
||||||
[](https://travis-ci.com/gr2m/universal-user-agent)
|
[](https://travis-ci.com/gr2m/universal-user-agent)
|
||||||
[](https://coveralls.io/github/gr2m/universal-user-agent)
|
|
||||||
[](https://greenkeeper.io/)
|
[](https://greenkeeper.io/)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const getUserAgent = require('universal-user-agent')
|
const { getUserAgent } = require("universal-user-agent");
|
||||||
const userAgent = getUserAgent()
|
// or import { getUserAgent } from "universal-user-agent";
|
||||||
|
|
||||||
|
const userAgent = getUserAgent();
|
||||||
// userAgent will look like this
|
// 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 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)
|
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)
|
||||||
|
6
node_modules/@octokit/request/node_modules/universal-user-agent/browser.js
generated
vendored
6
node_modules/@octokit/request/node_modules/universal-user-agent/browser.js
generated
vendored
@ -1,6 +0,0 @@
|
|||||||
module.exports = getUserAgentBrowser
|
|
||||||
|
|
||||||
function getUserAgentBrowser () {
|
|
||||||
/* global navigator */
|
|
||||||
return navigator.userAgent
|
|
||||||
}
|
|
4
node_modules/@octokit/request/node_modules/universal-user-agent/cypress.json
generated
vendored
4
node_modules/@octokit/request/node_modules/universal-user-agent/cypress.json
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"integrationFolder": "test",
|
|
||||||
"video": false
|
|
||||||
}
|
|
22
node_modules/@octokit/request/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal file
22
node_modules/@octokit/request/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal 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
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal 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;;;;;;"}
|
3
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
3
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
12
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal file
12
node_modules/@octokit/request/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
6
node_modules/@octokit/request/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
6
node_modules/@octokit/request/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getUserAgent };
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/request/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal 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;;;;"}
|
1
node_modules/@octokit/request/node_modules/universal-user-agent/index.d.ts
generated
vendored
1
node_modules/@octokit/request/node_modules/universal-user-agent/index.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export default function getUserAgentNode(): string;
|
|
15
node_modules/@octokit/request/node_modules/universal-user-agent/index.js
generated
vendored
15
node_modules/@octokit/request/node_modules/universal-user-agent/index.js
generated
vendored
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
77
node_modules/@octokit/request/node_modules/universal-user-agent/package.json
generated
vendored
77
node_modules/@octokit/request/node_modules/universal-user-agent/package.json
generated
vendored
@ -1,85 +1,68 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"universal-user-agent@3.0.0",
|
"universal-user-agent@4.0.0",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "universal-user-agent@3.0.0",
|
"_from": "universal-user-agent@4.0.0",
|
||||||
"_id": "universal-user-agent@3.0.0",
|
"_id": "universal-user-agent@4.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
|
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
"_location": "/@octokit/request/universal-user-agent",
|
"_location": "/@octokit/request/universal-user-agent",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "universal-user-agent@3.0.0",
|
"raw": "universal-user-agent@4.0.0",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
"escapedName": "universal-user-agent",
|
"escapedName": "universal-user-agent",
|
||||||
"rawSpec": "3.0.0",
|
"rawSpec": "4.0.0",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "3.0.0"
|
"fetchSpec": "4.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@octokit/request"
|
"/@octokit/request"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
"_spec": "3.0.0",
|
"_spec": "4.0.0",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"author": {
|
|
||||||
"name": "Gregor Martynus",
|
|
||||||
"url": "https://github.com/gr2m"
|
|
||||||
},
|
|
||||||
"browser": "browser.js",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"os-name": "^3.0.0"
|
"os-name": "^3.1.0"
|
||||||
},
|
},
|
||||||
"description": "Get a user agent string in both browser and node",
|
"description": "Get a user agent string in both browser and node",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.1.2",
|
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
|
||||||
"coveralls": "^3.0.2",
|
"@pika/pack": "^0.5.0",
|
||||||
"cypress": "^3.1.0",
|
"@pika/plugin-build-node": "^0.6.0",
|
||||||
"mocha": "^6.0.0",
|
"@pika/plugin-ts-standard-pkg": "^0.6.0",
|
||||||
"nyc": "^14.0.0",
|
"@types/jest": "^24.0.18",
|
||||||
"proxyquire": "^2.1.0",
|
"jest": "^24.9.0",
|
||||||
|
"prettier": "^1.18.2",
|
||||||
"semantic-release": "^15.9.15",
|
"semantic-release": "^15.9.15",
|
||||||
"sinon": "^7.2.4",
|
"ts-jest": "^24.0.2",
|
||||||
"sinon-chai": "^3.2.0",
|
"typescript": "^3.6.2"
|
||||||
"standard": "^13.0.1",
|
|
||||||
"test": "^0.6.0",
|
|
||||||
"travis-deploy-once": "^5.0.7"
|
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"dist-*/",
|
||||||
|
"bin/"
|
||||||
|
],
|
||||||
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "index.js",
|
"main": "dist-node/index.js",
|
||||||
|
"module": "dist-web/index.js",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
|
"pika": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"sideEffects": false,
|
||||||
"coverage": "nyc report --reporter=html && open coverage/index.html",
|
"source": "dist-src/index.js",
|
||||||
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
|
"types": "dist-types/index.d.ts",
|
||||||
"pretest": "standard",
|
"version": "4.0.0"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
|
57
node_modules/@octokit/request/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
57
node_modules/@octokit/request/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
@ -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')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
33
node_modules/@octokit/request/package.json
generated
vendored
33
node_modules/@octokit/request/package.json
generated
vendored
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"@octokit/request@5.0.2",
|
"@octokit/request@5.1.0",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "@octokit/request@5.0.2",
|
"_from": "@octokit/request@5.1.0",
|
||||||
"_id": "@octokit/request@5.0.2",
|
"_id": "@octokit/request@5.1.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-z1BQr43g4kOL4ZrIVBMHwi68Yg9VbkRUyuAgqCp1rU3vbYa69+2gIld/+gHclw15bJWQnhqqyEb7h5a5EqgZ0A==",
|
"_integrity": "sha512-I15T9PwjFs4tbWyhtFU2Kq7WDPidYMvRB7spmxoQRZfxSmiqullG+Nz+KbSmpkfnlvHwTr1e31R5WReFRKMXjg==",
|
||||||
"_location": "/@octokit/request",
|
"_location": "/@octokit/request",
|
||||||
"_phantomChildren": {
|
"_phantomChildren": {
|
||||||
"os-name": "3.1.0"
|
"os-name": "3.1.0"
|
||||||
@ -16,20 +16,20 @@
|
|||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@octokit/request@5.0.2",
|
"raw": "@octokit/request@5.1.0",
|
||||||
"name": "@octokit/request",
|
"name": "@octokit/request",
|
||||||
"escapedName": "@octokit%2frequest",
|
"escapedName": "@octokit%2frequest",
|
||||||
"scope": "@octokit",
|
"scope": "@octokit",
|
||||||
"rawSpec": "5.0.2",
|
"rawSpec": "5.1.0",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "5.0.2"
|
"fetchSpec": "5.1.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@octokit/graphql",
|
"/@octokit/graphql",
|
||||||
"/@octokit/rest"
|
"/@octokit/rest"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.0.2.tgz",
|
"_resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.1.0.tgz",
|
||||||
"_spec": "5.0.2",
|
"_spec": "5.1.0",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/octokit/request.js/issues"
|
"url": "https://github.com/octokit/request.js/issues"
|
||||||
@ -41,21 +41,24 @@
|
|||||||
"is-plain-object": "^3.0.0",
|
"is-plain-object": "^3.0.0",
|
||||||
"node-fetch": "^2.3.0",
|
"node-fetch": "^2.3.0",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
"universal-user-agent": "^3.0.0"
|
"universal-user-agent": "^4.0.0"
|
||||||
},
|
},
|
||||||
"description": "Send parameterized requests to GitHub’s APIs with sensible defaults in browsers and Node",
|
"description": "Send parameterized requests to GitHub’s APIs with sensible defaults in browsers and Node",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@pika/pack": "^0.4.0",
|
"@octokit/auth-app": "^2.1.2",
|
||||||
"@pika/plugin-build-node": "^0.5.1",
|
"@pika/pack": "^0.5.0",
|
||||||
"@pika/plugin-build-web": "^0.5.1",
|
"@pika/plugin-build-node": "^0.6.0",
|
||||||
"@pika/plugin-ts-standard-pkg": "^0.5.1",
|
"@pika/plugin-build-web": "^0.6.0",
|
||||||
|
"@pika/plugin-ts-standard-pkg": "^0.6.0",
|
||||||
"@types/fetch-mock": "^7.2.4",
|
"@types/fetch-mock": "^7.2.4",
|
||||||
"@types/jest": "^24.0.12",
|
"@types/jest": "^24.0.12",
|
||||||
|
"@types/lolex": "^3.1.1",
|
||||||
"@types/node": "^12.0.3",
|
"@types/node": "^12.0.3",
|
||||||
"@types/node-fetch": "^2.3.3",
|
"@types/node-fetch": "^2.3.3",
|
||||||
"@types/once": "^1.4.0",
|
"@types/once": "^1.4.0",
|
||||||
"fetch-mock": "^7.2.0",
|
"fetch-mock": "^7.2.0",
|
||||||
"jest": "^24.7.1",
|
"jest": "^24.7.1",
|
||||||
|
"lolex": "^4.2.0",
|
||||||
"prettier": "^1.17.0",
|
"prettier": "^1.17.0",
|
||||||
"semantic-release": "^15.10.5",
|
"semantic-release": "^15.10.5",
|
||||||
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
"semantic-release-plugin-update-version-in-files": "^1.0.0",
|
||||||
@ -88,5 +91,5 @@
|
|||||||
"sideEffects": false,
|
"sideEffects": false,
|
||||||
"source": "dist-src/index.js",
|
"source": "dist-src/index.js",
|
||||||
"types": "dist-types/index.d.ts",
|
"types": "dist-types/index.d.ts",
|
||||||
"version": "5.0.2"
|
"version": "5.1.0"
|
||||||
}
|
}
|
||||||
|
2
node_modules/@octokit/rest/lib/parse-client-options.js
generated
vendored
2
node_modules/@octokit/rest/lib/parse-client-options.js
generated
vendored
@ -1,7 +1,7 @@
|
|||||||
module.exports = parseOptions
|
module.exports = parseOptions
|
||||||
|
|
||||||
const { Deprecation } = require('deprecation')
|
const { Deprecation } = require('deprecation')
|
||||||
const getUserAgent = require('universal-user-agent')
|
const { getUserAgent } = require('universal-user-agent')
|
||||||
const once = require('once')
|
const once = require('once')
|
||||||
|
|
||||||
const pkg = require('../package.json')
|
const pkg = require('../package.json')
|
||||||
|
35
node_modules/@octokit/rest/node_modules/universal-user-agent/.travis.yml
generated
vendored
35
node_modules/@octokit/rest/node_modules/universal-user-agent/.travis.yml
generated
vendored
@ -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
|
|
6
node_modules/@octokit/rest/node_modules/universal-user-agent/README.md
generated
vendored
6
node_modules/@octokit/rest/node_modules/universal-user-agent/README.md
generated
vendored
@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
[](https://www.npmjs.com/package/universal-user-agent)
|
[](https://www.npmjs.com/package/universal-user-agent)
|
||||||
[](https://travis-ci.com/gr2m/universal-user-agent)
|
[](https://travis-ci.com/gr2m/universal-user-agent)
|
||||||
[](https://coveralls.io/github/gr2m/universal-user-agent)
|
|
||||||
[](https://greenkeeper.io/)
|
[](https://greenkeeper.io/)
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const getUserAgent = require('universal-user-agent')
|
const { getUserAgent } = require("universal-user-agent");
|
||||||
const userAgent = getUserAgent()
|
// or import { getUserAgent } from "universal-user-agent";
|
||||||
|
|
||||||
|
const userAgent = getUserAgent();
|
||||||
// userAgent will look like this
|
// 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 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)
|
// in node: Node.js/v8.9.4 (macOS High Sierra; x64)
|
||||||
|
6
node_modules/@octokit/rest/node_modules/universal-user-agent/browser.js
generated
vendored
6
node_modules/@octokit/rest/node_modules/universal-user-agent/browser.js
generated
vendored
@ -1,6 +0,0 @@
|
|||||||
module.exports = getUserAgentBrowser
|
|
||||||
|
|
||||||
function getUserAgentBrowser () {
|
|
||||||
/* global navigator */
|
|
||||||
return navigator.userAgent
|
|
||||||
}
|
|
4
node_modules/@octokit/rest/node_modules/universal-user-agent/cypress.json
generated
vendored
4
node_modules/@octokit/rest/node_modules/universal-user-agent/cypress.json
generated
vendored
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"integrationFolder": "test",
|
|
||||||
"video": false
|
|
||||||
}
|
|
22
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal file
22
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-node/index.js
generated
vendored
Normal 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
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-node/index.js.map
generated
vendored
Normal 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;;;;;;"}
|
3
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
3
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/browser.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
export function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/index.js
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
12
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal file
12
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-src/node.js
generated
vendored
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/browser.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { getUserAgent } from "./node";
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-types/node.d.ts
generated
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare function getUserAgent(): string;
|
6
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
6
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-web/index.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
function getUserAgent() {
|
||||||
|
return navigator.userAgent;
|
||||||
|
}
|
||||||
|
|
||||||
|
export { getUserAgent };
|
||||||
|
//# sourceMappingURL=index.js.map
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal file
1
node_modules/@octokit/rest/node_modules/universal-user-agent/dist-web/index.js.map
generated
vendored
Normal 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;;;;"}
|
1
node_modules/@octokit/rest/node_modules/universal-user-agent/index.d.ts
generated
vendored
1
node_modules/@octokit/rest/node_modules/universal-user-agent/index.d.ts
generated
vendored
@ -1 +0,0 @@
|
|||||||
export default function getUserAgentNode(): string;
|
|
15
node_modules/@octokit/rest/node_modules/universal-user-agent/index.js
generated
vendored
15
node_modules/@octokit/rest/node_modules/universal-user-agent/index.js
generated
vendored
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
77
node_modules/@octokit/rest/node_modules/universal-user-agent/package.json
generated
vendored
77
node_modules/@octokit/rest/node_modules/universal-user-agent/package.json
generated
vendored
@ -1,85 +1,68 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"universal-user-agent@3.0.0",
|
"universal-user-agent@4.0.0",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "universal-user-agent@3.0.0",
|
"_from": "universal-user-agent@4.0.0",
|
||||||
"_id": "universal-user-agent@3.0.0",
|
"_id": "universal-user-agent@4.0.0",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-T3siHThqoj5X0benA5H0qcDnrKGXzU8TKoX15x/tQHw1hQBvIEBHjxQ2klizYsqBOO/Q+WuxoQUihadeeqDnoA==",
|
"_integrity": "sha512-eM8knLpev67iBDizr/YtqkJsF3GK8gzDc6st/WKzrTuPtcsOKW/0IdL4cnMBsU69pOx0otavLWBDGTwg+dB0aA==",
|
||||||
"_location": "/@octokit/rest/universal-user-agent",
|
"_location": "/@octokit/rest/universal-user-agent",
|
||||||
"_phantomChildren": {},
|
"_phantomChildren": {},
|
||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "universal-user-agent@3.0.0",
|
"raw": "universal-user-agent@4.0.0",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
"escapedName": "universal-user-agent",
|
"escapedName": "universal-user-agent",
|
||||||
"rawSpec": "3.0.0",
|
"rawSpec": "4.0.0",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "3.0.0"
|
"fetchSpec": "4.0.0"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@octokit/rest"
|
"/@octokit/rest"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-3.0.0.tgz",
|
"_resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-4.0.0.tgz",
|
||||||
"_spec": "3.0.0",
|
"_spec": "4.0.0",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"author": {
|
|
||||||
"name": "Gregor Martynus",
|
|
||||||
"url": "https://github.com/gr2m"
|
|
||||||
},
|
|
||||||
"browser": "browser.js",
|
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
"url": "https://github.com/gr2m/universal-user-agent/issues"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"os-name": "^3.0.0"
|
"os-name": "^3.1.0"
|
||||||
},
|
},
|
||||||
"description": "Get a user agent string in both browser and node",
|
"description": "Get a user agent string in both browser and node",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.1.2",
|
"@gr2m/pika-plugin-build-web": "^0.6.0-issue-84.1",
|
||||||
"coveralls": "^3.0.2",
|
"@pika/pack": "^0.5.0",
|
||||||
"cypress": "^3.1.0",
|
"@pika/plugin-build-node": "^0.6.0",
|
||||||
"mocha": "^6.0.0",
|
"@pika/plugin-ts-standard-pkg": "^0.6.0",
|
||||||
"nyc": "^14.0.0",
|
"@types/jest": "^24.0.18",
|
||||||
"proxyquire": "^2.1.0",
|
"jest": "^24.9.0",
|
||||||
|
"prettier": "^1.18.2",
|
||||||
"semantic-release": "^15.9.15",
|
"semantic-release": "^15.9.15",
|
||||||
"sinon": "^7.2.4",
|
"ts-jest": "^24.0.2",
|
||||||
"sinon-chai": "^3.2.0",
|
"typescript": "^3.6.2"
|
||||||
"standard": "^13.0.1",
|
|
||||||
"test": "^0.6.0",
|
|
||||||
"travis-deploy-once": "^5.0.7"
|
|
||||||
},
|
},
|
||||||
|
"files": [
|
||||||
|
"dist-*/",
|
||||||
|
"bin/"
|
||||||
|
],
|
||||||
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
"homepage": "https://github.com/gr2m/universal-user-agent#readme",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"main": "index.js",
|
"main": "dist-node/index.js",
|
||||||
|
"module": "dist-web/index.js",
|
||||||
"name": "universal-user-agent",
|
"name": "universal-user-agent",
|
||||||
|
"pika": true,
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
"url": "git+https://github.com/gr2m/universal-user-agent.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"sideEffects": false,
|
||||||
"coverage": "nyc report --reporter=html && open coverage/index.html",
|
"source": "dist-src/index.js",
|
||||||
"coverage:upload": "nyc report --reporter=text-lcov | coveralls",
|
"types": "dist-types/index.d.ts",
|
||||||
"pretest": "standard",
|
"version": "4.0.0"
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
|
57
node_modules/@octokit/rest/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
57
node_modules/@octokit/rest/node_modules/universal-user-agent/test/smoke-test.js
generated
vendored
@ -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')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
27
node_modules/@octokit/rest/package.json
generated
vendored
27
node_modules/@octokit/rest/package.json
generated
vendored
@ -1,14 +1,14 @@
|
|||||||
{
|
{
|
||||||
"_args": [
|
"_args": [
|
||||||
[
|
[
|
||||||
"@octokit/rest@16.28.7",
|
"@octokit/rest@16.28.9",
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
"/home/svenstaro/prj/upload-release-action"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"_from": "@octokit/rest@16.28.7",
|
"_from": "@octokit/rest@16.28.9",
|
||||||
"_id": "@octokit/rest@16.28.7",
|
"_id": "@octokit/rest@16.28.9",
|
||||||
"_inBundle": false,
|
"_inBundle": false,
|
||||||
"_integrity": "sha512-cznFSLEhh22XD3XeqJw51OLSfyL2fcFKUO+v2Ep9MTAFfFLS1cK1Zwd1yEgQJmJoDnj4/vv3+fGGZweG+xsbIA==",
|
"_integrity": "sha512-IKGnX+Tvzt7XHhs8f4ajqxyJvYAMNX5nWfoJm4CQj8LZToMiaJgutf5KxxpxoC3y5w7JTJpW5rnWnF4TsIvCLA==",
|
||||||
"_location": "/@octokit/rest",
|
"_location": "/@octokit/rest",
|
||||||
"_phantomChildren": {
|
"_phantomChildren": {
|
||||||
"os-name": "3.1.0"
|
"os-name": "3.1.0"
|
||||||
@ -16,19 +16,19 @@
|
|||||||
"_requested": {
|
"_requested": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"registry": true,
|
"registry": true,
|
||||||
"raw": "@octokit/rest@16.28.7",
|
"raw": "@octokit/rest@16.28.9",
|
||||||
"name": "@octokit/rest",
|
"name": "@octokit/rest",
|
||||||
"escapedName": "@octokit%2frest",
|
"escapedName": "@octokit%2frest",
|
||||||
"scope": "@octokit",
|
"scope": "@octokit",
|
||||||
"rawSpec": "16.28.7",
|
"rawSpec": "16.28.9",
|
||||||
"saveSpec": null,
|
"saveSpec": null,
|
||||||
"fetchSpec": "16.28.7"
|
"fetchSpec": "16.28.9"
|
||||||
},
|
},
|
||||||
"_requiredBy": [
|
"_requiredBy": [
|
||||||
"/@actions/github"
|
"/@actions/github"
|
||||||
],
|
],
|
||||||
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.7.tgz",
|
"_resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-16.28.9.tgz",
|
||||||
"_spec": "16.28.7",
|
"_spec": "16.28.9",
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
"_where": "/home/svenstaro/prj/upload-release-action",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Gregor Martynus",
|
"name": "Gregor Martynus",
|
||||||
@ -73,8 +73,7 @@
|
|||||||
"lodash.uniq": "^4.5.0",
|
"lodash.uniq": "^4.5.0",
|
||||||
"octokit-pagination-methods": "^1.1.0",
|
"octokit-pagination-methods": "^1.1.0",
|
||||||
"once": "^1.4.0",
|
"once": "^1.4.0",
|
||||||
"universal-user-agent": "^3.0.0",
|
"universal-user-agent": "^4.0.0"
|
||||||
"url-template": "^2.0.8"
|
|
||||||
},
|
},
|
||||||
"description": "GitHub REST API client for Node.js",
|
"description": "GitHub REST API client for Node.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -102,8 +101,8 @@
|
|||||||
"semantic-release": "^15.0.0",
|
"semantic-release": "^15.0.0",
|
||||||
"sinon": "^7.2.4",
|
"sinon": "^7.2.4",
|
||||||
"sinon-chai": "^3.0.0",
|
"sinon-chai": "^3.0.0",
|
||||||
"sort-keys": "^3.0.0",
|
"sort-keys": "^4.0.0",
|
||||||
"standard": "^13.0.1",
|
"standard": "^14.0.2",
|
||||||
"string-to-arraybuffer": "^1.0.0",
|
"string-to-arraybuffer": "^1.0.0",
|
||||||
"string-to-jsdoc-comment": "^1.0.0",
|
"string-to-jsdoc-comment": "^1.0.0",
|
||||||
"typescript": "^3.3.1",
|
"typescript": "^3.3.1",
|
||||||
@ -185,5 +184,5 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"version": "16.28.7"
|
"version": "16.28.9"
|
||||||
}
|
}
|
||||||
|
10
node_modules/@octokit/rest/plugins/authentication-deprecated/before-request.js
generated
vendored
10
node_modules/@octokit/rest/plugins/authentication-deprecated/before-request.js
generated
vendored
@ -10,20 +10,20 @@ function authenticationBeforeRequest (state, options) {
|
|||||||
|
|
||||||
if (state.auth.type === 'basic') {
|
if (state.auth.type === 'basic') {
|
||||||
const hash = btoa(`${state.auth.username}:${state.auth.password}`)
|
const hash = btoa(`${state.auth.username}:${state.auth.password}`)
|
||||||
options.headers['authorization'] = `Basic ${hash}`
|
options.headers.authorization = `Basic ${hash}`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.auth.type === 'token') {
|
if (state.auth.type === 'token') {
|
||||||
options.headers['authorization'] = `token ${state.auth.token}`
|
options.headers.authorization = `token ${state.auth.token}`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.auth.type === 'app') {
|
if (state.auth.type === 'app') {
|
||||||
options.headers['authorization'] = `Bearer ${state.auth.token}`
|
options.headers.authorization = `Bearer ${state.auth.token}`
|
||||||
const acceptHeaders = options.headers['accept'].split(',')
|
const acceptHeaders = options.headers.accept.split(',')
|
||||||
.concat('application/vnd.github.machine-man-preview+json')
|
.concat('application/vnd.github.machine-man-preview+json')
|
||||||
options.headers['accept'] = uniq(acceptHeaders).filter(Boolean).join(',')
|
options.headers.accept = uniq(acceptHeaders).filter(Boolean).join(',')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
14
node_modules/@octokit/rest/plugins/authentication/before-request.js
generated
vendored
14
node_modules/@octokit/rest/plugins/authentication/before-request.js
generated
vendored
@ -6,13 +6,13 @@ const withAuthorizationPrefix = require('./with-authorization-prefix')
|
|||||||
|
|
||||||
function authenticationBeforeRequest (state, options) {
|
function authenticationBeforeRequest (state, options) {
|
||||||
if (typeof state.auth === 'string') {
|
if (typeof state.auth === 'string') {
|
||||||
options.headers['authorization'] = withAuthorizationPrefix(state.auth)
|
options.headers.authorization = withAuthorizationPrefix(state.auth)
|
||||||
|
|
||||||
// https://developer.github.com/v3/previews/#integrations
|
// https://developer.github.com/v3/previews/#integrations
|
||||||
if (/^bearer /i.test(state.auth) && !/machine-man/.test(options.headers['accept'])) {
|
if (/^bearer /i.test(state.auth) && !/machine-man/.test(options.headers.accept)) {
|
||||||
const acceptHeaders = options.headers['accept'].split(',')
|
const acceptHeaders = options.headers.accept.split(',')
|
||||||
.concat('application/vnd.github.machine-man-preview+json')
|
.concat('application/vnd.github.machine-man-preview+json')
|
||||||
options.headers['accept'] = acceptHeaders.filter(Boolean).join(',')
|
options.headers.accept = acceptHeaders.filter(Boolean).join(',')
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -20,7 +20,7 @@ function authenticationBeforeRequest (state, options) {
|
|||||||
|
|
||||||
if (state.auth.username) {
|
if (state.auth.username) {
|
||||||
const hash = btoa(`${state.auth.username}:${state.auth.password}`)
|
const hash = btoa(`${state.auth.username}:${state.auth.password}`)
|
||||||
options.headers['authorization'] = `Basic ${hash}`
|
options.headers.authorization = `Basic ${hash}`
|
||||||
if (state.otp) {
|
if (state.otp) {
|
||||||
options.headers['x-github-otp'] = state.otp
|
options.headers['x-github-otp'] = state.otp
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ function authenticationBeforeRequest (state, options) {
|
|||||||
// as well as "/applications/123/tokens/token456"
|
// as well as "/applications/123/tokens/token456"
|
||||||
if (/\/applications\/:?[\w_]+\/tokens\/:?[\w_]+($|\?)/.test(options.url)) {
|
if (/\/applications\/:?[\w_]+\/tokens\/:?[\w_]+($|\?)/.test(options.url)) {
|
||||||
const hash = btoa(`${state.auth.clientId}:${state.auth.clientSecret}`)
|
const hash = btoa(`${state.auth.clientId}:${state.auth.clientSecret}`)
|
||||||
options.headers['authorization'] = `Basic ${hash}`
|
options.headers.authorization = `Basic ${hash}`
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,6 +56,6 @@ function authenticationBeforeRequest (state, options) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
.then((authorization) => {
|
.then((authorization) => {
|
||||||
options.headers['authorization'] = withAuthorizationPrefix(authorization)
|
options.headers.authorization = withAuthorizationPrefix(authorization)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
2
node_modules/@octokit/rest/plugins/log/index.js
generated
vendored
2
node_modules/@octokit/rest/plugins/log/index.js
generated
vendored
@ -2,7 +2,7 @@ module.exports = octokitDebug
|
|||||||
|
|
||||||
function octokitDebug (octokit) {
|
function octokitDebug (octokit) {
|
||||||
octokit.hook.wrap('request', (request, options) => {
|
octokit.hook.wrap('request', (request, options) => {
|
||||||
octokit.log.debug(`request`, options)
|
octokit.log.debug('request', options)
|
||||||
const start = Date.now()
|
const start = Date.now()
|
||||||
const requestOptions = octokit.request.endpoint.parse(options)
|
const requestOptions = octokit.request.endpoint.parse(options)
|
||||||
const path = requestOptions.url.replace(options.baseUrl, '')
|
const path = requestOptions.url.replace(options.baseUrl, '')
|
||||||
|
133
node_modules/deepmerge/changelog.md
generated
vendored
133
node_modules/deepmerge/changelog.md
generated
vendored
@ -1,133 +0,0 @@
|
|||||||
# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0)
|
|
||||||
|
|
||||||
- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155)
|
|
||||||
|
|
||||||
# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0)
|
|
||||||
|
|
||||||
- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151)
|
|
||||||
|
|
||||||
# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1)
|
|
||||||
|
|
||||||
- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149)
|
|
||||||
|
|
||||||
# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0)
|
|
||||||
|
|
||||||
- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133)
|
|
||||||
|
|
||||||
# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0)
|
|
||||||
|
|
||||||
- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129)
|
|
||||||
|
|
||||||
# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0)
|
|
||||||
|
|
||||||
- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123)
|
|
||||||
|
|
||||||
# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1)
|
|
||||||
|
|
||||||
- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121)
|
|
||||||
|
|
||||||
# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0)
|
|
||||||
|
|
||||||
- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119)
|
|
||||||
|
|
||||||
# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1)
|
|
||||||
|
|
||||||
- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103)
|
|
||||||
- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107)
|
|
||||||
- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109)
|
|
||||||
|
|
||||||
|
|
||||||
# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0)
|
|
||||||
|
|
||||||
- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96)
|
|
||||||
- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100)
|
|
||||||
|
|
||||||
# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1)
|
|
||||||
|
|
||||||
- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84)
|
|
||||||
|
|
||||||
# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0)
|
|
||||||
|
|
||||||
- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))`
|
|
||||||
- breaking: The `clone` option now defaults to `true`
|
|
||||||
- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements
|
|
||||||
|
|
||||||
See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77).
|
|
||||||
|
|
||||||
# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2)
|
|
||||||
|
|
||||||
- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76)
|
|
||||||
|
|
||||||
# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1)
|
|
||||||
|
|
||||||
- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63)
|
|
||||||
|
|
||||||
# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0)
|
|
||||||
|
|
||||||
- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change.
|
|
||||||
|
|
||||||
# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4)
|
|
||||||
|
|
||||||
- bower support: updated `main` in bower.json
|
|
||||||
|
|
||||||
# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3)
|
|
||||||
|
|
||||||
- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24)
|
|
||||||
|
|
||||||
# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2)
|
|
||||||
|
|
||||||
- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c)
|
|
||||||
|
|
||||||
# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1)
|
|
||||||
|
|
||||||
- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47)
|
|
||||||
|
|
||||||
# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0)
|
|
||||||
|
|
||||||
- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62)
|
|
||||||
|
|
||||||
# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2)
|
|
||||||
|
|
||||||
- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56)
|
|
||||||
- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57)
|
|
||||||
|
|
||||||
# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1)
|
|
||||||
|
|
||||||
- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51)
|
|
||||||
|
|
||||||
# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0)
|
|
||||||
|
|
||||||
- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50)
|
|
||||||
|
|
||||||
# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0)
|
|
||||||
|
|
||||||
- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46)
|
|
||||||
- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48)
|
|
||||||
- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47)
|
|
||||||
|
|
||||||
# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1)
|
|
||||||
|
|
||||||
- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46)
|
|
||||||
|
|
||||||
# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0)
|
|
||||||
|
|
||||||
- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37)
|
|
||||||
|
|
||||||
# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3)
|
|
||||||
|
|
||||||
- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38)
|
|
||||||
- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb)
|
|
||||||
|
|
||||||
# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2)
|
|
||||||
|
|
||||||
- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5)
|
|
||||||
|
|
||||||
# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1)
|
|
||||||
|
|
||||||
- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586)
|
|
||||||
|
|
||||||
# 1.0.0
|
|
||||||
|
|
||||||
- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15)
|
|
||||||
- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30)
|
|
||||||
- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31)
|
|
111
node_modules/deepmerge/dist/cjs.js
generated
vendored
111
node_modules/deepmerge/dist/cjs.js
generated
vendored
@ -1,111 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
var isMergeableObject = function isMergeableObject(value) {
|
|
||||||
return isNonNullObject(value)
|
|
||||||
&& !isSpecial(value)
|
|
||||||
};
|
|
||||||
|
|
||||||
function isNonNullObject(value) {
|
|
||||||
return !!value && typeof value === 'object'
|
|
||||||
}
|
|
||||||
|
|
||||||
function isSpecial(value) {
|
|
||||||
var stringValue = Object.prototype.toString.call(value);
|
|
||||||
|
|
||||||
return stringValue === '[object RegExp]'
|
|
||||||
|| stringValue === '[object Date]'
|
|
||||||
|| isReactElement(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
||||||
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
||||||
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
||||||
|
|
||||||
function isReactElement(value) {
|
|
||||||
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
||||||
}
|
|
||||||
|
|
||||||
function emptyTarget(val) {
|
|
||||||
return Array.isArray(val) ? [] : {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
||||||
return (options.clone !== false && options.isMergeableObject(value))
|
|
||||||
? deepmerge(emptyTarget(value), value, options)
|
|
||||||
: value
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultArrayMerge(target, source, options) {
|
|
||||||
return target.concat(source).map(function(element) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(element, options)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMergeFunction(key, options) {
|
|
||||||
if (!options.customMerge) {
|
|
||||||
return deepmerge
|
|
||||||
}
|
|
||||||
var customMerge = options.customMerge(key);
|
|
||||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEnumerableOwnPropertySymbols(target) {
|
|
||||||
return Object.getOwnPropertySymbols
|
|
||||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
||||||
return target.propertyIsEnumerable(symbol)
|
|
||||||
})
|
|
||||||
: []
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeys(target) {
|
|
||||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeObject(target, source, options) {
|
|
||||||
var destination = {};
|
|
||||||
if (options.isMergeableObject(target)) {
|
|
||||||
getKeys(target).forEach(function(key) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getKeys(source).forEach(function(key) {
|
|
||||||
if (!options.isMergeableObject(source[key]) || !target[key]) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
||||||
} else {
|
|
||||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return destination
|
|
||||||
}
|
|
||||||
|
|
||||||
function deepmerge(target, source, options) {
|
|
||||||
options = options || {};
|
|
||||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
||||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
||||||
|
|
||||||
var sourceIsArray = Array.isArray(source);
|
|
||||||
var targetIsArray = Array.isArray(target);
|
|
||||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
||||||
|
|
||||||
if (!sourceAndTargetTypesMatch) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(source, options)
|
|
||||||
} else if (sourceIsArray) {
|
|
||||||
return options.arrayMerge(target, source, options)
|
|
||||||
} else {
|
|
||||||
return mergeObject(target, source, options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deepmerge.all = function deepmergeAll(array, options) {
|
|
||||||
if (!Array.isArray(array)) {
|
|
||||||
throw new Error('first argument should be an array')
|
|
||||||
}
|
|
||||||
|
|
||||||
return array.reduce(function(prev, next) {
|
|
||||||
return deepmerge(prev, next, options)
|
|
||||||
}, {})
|
|
||||||
};
|
|
||||||
|
|
||||||
var deepmerge_1 = deepmerge;
|
|
||||||
|
|
||||||
module.exports = deepmerge_1;
|
|
117
node_modules/deepmerge/dist/umd.js
generated
vendored
117
node_modules/deepmerge/dist/umd.js
generated
vendored
@ -1,117 +0,0 @@
|
|||||||
(function (global, factory) {
|
|
||||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
||||||
typeof define === 'function' && define.amd ? define(factory) :
|
|
||||||
(global = global || self, global.deepmerge = factory());
|
|
||||||
}(this, function () { 'use strict';
|
|
||||||
|
|
||||||
var isMergeableObject = function isMergeableObject(value) {
|
|
||||||
return isNonNullObject(value)
|
|
||||||
&& !isSpecial(value)
|
|
||||||
};
|
|
||||||
|
|
||||||
function isNonNullObject(value) {
|
|
||||||
return !!value && typeof value === 'object'
|
|
||||||
}
|
|
||||||
|
|
||||||
function isSpecial(value) {
|
|
||||||
var stringValue = Object.prototype.toString.call(value);
|
|
||||||
|
|
||||||
return stringValue === '[object RegExp]'
|
|
||||||
|| stringValue === '[object Date]'
|
|
||||||
|| isReactElement(value)
|
|
||||||
}
|
|
||||||
|
|
||||||
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
||||||
var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
|
|
||||||
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
|
|
||||||
|
|
||||||
function isReactElement(value) {
|
|
||||||
return value.$$typeof === REACT_ELEMENT_TYPE
|
|
||||||
}
|
|
||||||
|
|
||||||
function emptyTarget(val) {
|
|
||||||
return Array.isArray(val) ? [] : {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
||||||
return (options.clone !== false && options.isMergeableObject(value))
|
|
||||||
? deepmerge(emptyTarget(value), value, options)
|
|
||||||
: value
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultArrayMerge(target, source, options) {
|
|
||||||
return target.concat(source).map(function(element) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(element, options)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMergeFunction(key, options) {
|
|
||||||
if (!options.customMerge) {
|
|
||||||
return deepmerge
|
|
||||||
}
|
|
||||||
var customMerge = options.customMerge(key);
|
|
||||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEnumerableOwnPropertySymbols(target) {
|
|
||||||
return Object.getOwnPropertySymbols
|
|
||||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
||||||
return target.propertyIsEnumerable(symbol)
|
|
||||||
})
|
|
||||||
: []
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeys(target) {
|
|
||||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeObject(target, source, options) {
|
|
||||||
var destination = {};
|
|
||||||
if (options.isMergeableObject(target)) {
|
|
||||||
getKeys(target).forEach(function(key) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getKeys(source).forEach(function(key) {
|
|
||||||
if (!options.isMergeableObject(source[key]) || !target[key]) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
||||||
} else {
|
|
||||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return destination
|
|
||||||
}
|
|
||||||
|
|
||||||
function deepmerge(target, source, options) {
|
|
||||||
options = options || {};
|
|
||||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
||||||
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
||||||
|
|
||||||
var sourceIsArray = Array.isArray(source);
|
|
||||||
var targetIsArray = Array.isArray(target);
|
|
||||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
||||||
|
|
||||||
if (!sourceAndTargetTypesMatch) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(source, options)
|
|
||||||
} else if (sourceIsArray) {
|
|
||||||
return options.arrayMerge(target, source, options)
|
|
||||||
} else {
|
|
||||||
return mergeObject(target, source, options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deepmerge.all = function deepmergeAll(array, options) {
|
|
||||||
if (!Array.isArray(array)) {
|
|
||||||
throw new Error('first argument should be an array')
|
|
||||||
}
|
|
||||||
|
|
||||||
return array.reduce(function(prev, next) {
|
|
||||||
return deepmerge(prev, next, options)
|
|
||||||
}, {})
|
|
||||||
};
|
|
||||||
|
|
||||||
var deepmerge_1 = deepmerge;
|
|
||||||
|
|
||||||
return deepmerge_1;
|
|
||||||
|
|
||||||
}));
|
|
16
node_modules/deepmerge/index.d.ts
generated
vendored
16
node_modules/deepmerge/index.d.ts
generated
vendored
@ -1,16 +0,0 @@
|
|||||||
declare function deepmerge<T>(x: Partial<T>, y: Partial<T>, options?: deepmerge.Options): T;
|
|
||||||
declare function deepmerge<T1, T2>(x: Partial<T1>, y: Partial<T2>, options?: deepmerge.Options): T1 & T2;
|
|
||||||
|
|
||||||
declare namespace deepmerge {
|
|
||||||
export interface Options {
|
|
||||||
arrayMerge?(target: any[], source: any[], options?: Options): any[];
|
|
||||||
clone?: boolean;
|
|
||||||
customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined;
|
|
||||||
isMergeableObject?(value: object): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function all (objects: object[], options?: Options): object;
|
|
||||||
export function all<T> (objects: Partial<T>[], options?: Options): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
export = deepmerge;
|
|
84
node_modules/deepmerge/index.js
generated
vendored
84
node_modules/deepmerge/index.js
generated
vendored
@ -1,84 +0,0 @@
|
|||||||
var defaultIsMergeableObject = require('is-mergeable-object')
|
|
||||||
|
|
||||||
function emptyTarget(val) {
|
|
||||||
return Array.isArray(val) ? [] : {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
||||||
return (options.clone !== false && options.isMergeableObject(value))
|
|
||||||
? deepmerge(emptyTarget(value), value, options)
|
|
||||||
: value
|
|
||||||
}
|
|
||||||
|
|
||||||
function defaultArrayMerge(target, source, options) {
|
|
||||||
return target.concat(source).map(function(element) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(element, options)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function getMergeFunction(key, options) {
|
|
||||||
if (!options.customMerge) {
|
|
||||||
return deepmerge
|
|
||||||
}
|
|
||||||
var customMerge = options.customMerge(key)
|
|
||||||
return typeof customMerge === 'function' ? customMerge : deepmerge
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEnumerableOwnPropertySymbols(target) {
|
|
||||||
return Object.getOwnPropertySymbols
|
|
||||||
? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
||||||
return target.propertyIsEnumerable(symbol)
|
|
||||||
})
|
|
||||||
: []
|
|
||||||
}
|
|
||||||
|
|
||||||
function getKeys(target) {
|
|
||||||
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
|
|
||||||
}
|
|
||||||
|
|
||||||
function mergeObject(target, source, options) {
|
|
||||||
var destination = {}
|
|
||||||
if (options.isMergeableObject(target)) {
|
|
||||||
getKeys(target).forEach(function(key) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
getKeys(source).forEach(function(key) {
|
|
||||||
if (!options.isMergeableObject(source[key]) || !target[key]) {
|
|
||||||
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options)
|
|
||||||
} else {
|
|
||||||
destination[key] = getMergeFunction(key, options)(target[key], source[key], options)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return destination
|
|
||||||
}
|
|
||||||
|
|
||||||
function deepmerge(target, source, options) {
|
|
||||||
options = options || {}
|
|
||||||
options.arrayMerge = options.arrayMerge || defaultArrayMerge
|
|
||||||
options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject
|
|
||||||
|
|
||||||
var sourceIsArray = Array.isArray(source)
|
|
||||||
var targetIsArray = Array.isArray(target)
|
|
||||||
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray
|
|
||||||
|
|
||||||
if (!sourceAndTargetTypesMatch) {
|
|
||||||
return cloneUnlessOtherwiseSpecified(source, options)
|
|
||||||
} else if (sourceIsArray) {
|
|
||||||
return options.arrayMerge(target, source, options)
|
|
||||||
} else {
|
|
||||||
return mergeObject(target, source, options)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deepmerge.all = function deepmergeAll(array, options) {
|
|
||||||
if (!Array.isArray(array)) {
|
|
||||||
throw new Error('first argument should be an array')
|
|
||||||
}
|
|
||||||
|
|
||||||
return array.reduce(function(prev, next) {
|
|
||||||
return deepmerge(prev, next, options)
|
|
||||||
}, {})
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = deepmerge
|
|
21
node_modules/deepmerge/license.txt
generated
vendored
21
node_modules/deepmerge/license.txt
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2012 James Halliday, Josh Duff, and other contributors
|
|
||||||
|
|
||||||
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.
|
|
74
node_modules/deepmerge/package.json
generated
vendored
74
node_modules/deepmerge/package.json
generated
vendored
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"deepmerge@4.0.0",
|
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "deepmerge@4.0.0",
|
|
||||||
"_id": "deepmerge@4.0.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-YZ1rOP5+kHor4hMAH+HRQnBQHg+wvS1un1hAOuIcxcBy0hzcUf6Jg2a1w65kpoOUnurOfZbERwjI1TfZxNjcww==",
|
|
||||||
"_location": "/deepmerge",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "deepmerge@4.0.0",
|
|
||||||
"name": "deepmerge",
|
|
||||||
"escapedName": "deepmerge",
|
|
||||||
"rawSpec": "4.0.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "4.0.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/@octokit/endpoint"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.0.0.tgz",
|
|
||||||
"_spec": "4.0.0",
|
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/TehShrike/deepmerge/issues"
|
|
||||||
},
|
|
||||||
"dependencies": {},
|
|
||||||
"description": "A library for deep (recursive) merging of Javascript objects",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^8.10.49",
|
|
||||||
"is-mergeable-object": "1.1.0",
|
|
||||||
"is-plain-object": "^2.0.4",
|
|
||||||
"jsmd": "^1.0.1",
|
|
||||||
"rollup": "^1.15.5",
|
|
||||||
"rollup-plugin-commonjs": "^10.0.0",
|
|
||||||
"rollup-plugin-node-resolve": "^5.0.2",
|
|
||||||
"tape": "^4.10.2",
|
|
||||||
"ts-node": "7.0.1",
|
|
||||||
"typescript": "=2.2.2",
|
|
||||||
"uglify-js": "^3.6.0"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.10.0"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/TehShrike/deepmerge",
|
|
||||||
"keywords": [
|
|
||||||
"merge",
|
|
||||||
"deep",
|
|
||||||
"extend",
|
|
||||||
"copy",
|
|
||||||
"clone",
|
|
||||||
"recursive"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "dist/cjs.js",
|
|
||||||
"name": "deepmerge",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/TehShrike/deepmerge.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"build": "rollup -c",
|
|
||||||
"size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c",
|
|
||||||
"test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript",
|
|
||||||
"test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts"
|
|
||||||
},
|
|
||||||
"version": "4.0.0"
|
|
||||||
}
|
|
264
node_modules/deepmerge/readme.md
generated
vendored
264
node_modules/deepmerge/readme.md
generated
vendored
@ -1,264 +0,0 @@
|
|||||||
# deepmerge
|
|
||||||
|
|
||||||
Merges the enumerable properties of two or more objects deeply.
|
|
||||||
|
|
||||||
> UMD bundle is 646B minified+gzipped
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
### Example Usage
|
|
||||||
<!--js
|
|
||||||
const merge = require('./')
|
|
||||||
-->
|
|
||||||
|
|
||||||
```js
|
|
||||||
const x = {
|
|
||||||
foo: { bar: 3 },
|
|
||||||
array: [{
|
|
||||||
does: 'work',
|
|
||||||
too: [ 1, 2, 3 ]
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
const y = {
|
|
||||||
foo: { baz: 4 },
|
|
||||||
quux: 5,
|
|
||||||
array: [{
|
|
||||||
does: 'work',
|
|
||||||
too: [ 4, 5, 6 ]
|
|
||||||
}, {
|
|
||||||
really: 'yes'
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
|
|
||||||
const output = {
|
|
||||||
foo: {
|
|
||||||
bar: 3,
|
|
||||||
baz: 4
|
|
||||||
},
|
|
||||||
array: [{
|
|
||||||
does: 'work',
|
|
||||||
too: [ 1, 2, 3 ]
|
|
||||||
}, {
|
|
||||||
does: 'work',
|
|
||||||
too: [ 4, 5, 6 ]
|
|
||||||
}, {
|
|
||||||
really: 'yes'
|
|
||||||
}],
|
|
||||||
quux: 5
|
|
||||||
}
|
|
||||||
|
|
||||||
merge(x, y) // => output
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
With [npm](http://npmjs.org) do:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm install deepmerge
|
|
||||||
```
|
|
||||||
|
|
||||||
deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js).
|
|
||||||
|
|
||||||
|
|
||||||
### Include
|
|
||||||
|
|
||||||
deepmerge exposes a CommonJS entry point:
|
|
||||||
|
|
||||||
```
|
|
||||||
const merge = require('deepmerge')
|
|
||||||
```
|
|
||||||
|
|
||||||
The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584).
|
|
||||||
|
|
||||||
# API
|
|
||||||
|
|
||||||
|
|
||||||
## `merge(x, y, [options])`
|
|
||||||
|
|
||||||
Merge two objects `x` and `y` deeply, returning a new merged object with the
|
|
||||||
elements from both `x` and `y`.
|
|
||||||
|
|
||||||
If an element at the same key is present for both `x` and `y`, the value from
|
|
||||||
`y` will appear in the result.
|
|
||||||
|
|
||||||
Merging creates a new object, so that neither `x` or `y` is modified.
|
|
||||||
|
|
||||||
**Note:** By default, arrays are merged by concatenating them.
|
|
||||||
|
|
||||||
## `merge.all(arrayOfObjects, [options])`
|
|
||||||
|
|
||||||
Merges any number of objects into a single result object.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const foobar = { foo: { bar: 3 } }
|
|
||||||
const foobaz = { foo: { baz: 4 } }
|
|
||||||
const bar = { bar: 'yay!' }
|
|
||||||
|
|
||||||
merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' }
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Options
|
|
||||||
|
|
||||||
### `arrayMerge`
|
|
||||||
|
|
||||||
There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function.
|
|
||||||
|
|
||||||
#### Overwrite Array
|
|
||||||
|
|
||||||
Overwrites the existing array values completely rather than concatenating them
|
|
||||||
|
|
||||||
```js
|
|
||||||
const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray
|
|
||||||
|
|
||||||
merge(
|
|
||||||
[1, 2, 3],
|
|
||||||
[3, 2, 1],
|
|
||||||
{ arrayMerge: overwriteMerge }
|
|
||||||
) // => [3, 2, 1]
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Combine Array
|
|
||||||
|
|
||||||
Combine arrays, such as overwriting existing defaults while also adding/keeping values that are different names
|
|
||||||
|
|
||||||
To use the legacy (pre-version-2.0.0) array merging algorithm, use the following:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const emptyTarget = value => Array.isArray(value) ? [] : {}
|
|
||||||
const clone = (value, options) => merge(emptyTarget(value), value, options)
|
|
||||||
|
|
||||||
const combineMerge = (target, source, options) => {
|
|
||||||
const destination = target.slice()
|
|
||||||
|
|
||||||
source.forEach((item, index) => {
|
|
||||||
if (typeof destination[index] === 'undefined') {
|
|
||||||
const cloneRequested = options.clone !== false
|
|
||||||
const shouldClone = cloneRequested && options.isMergeableObject(item)
|
|
||||||
destination[index] = shouldClone ? clone(item, options) : item
|
|
||||||
} else if (options.isMergeableObject(item)) {
|
|
||||||
destination[index] = merge(target[index], item, options)
|
|
||||||
} else if (target.indexOf(item) === -1) {
|
|
||||||
destination.push(item)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return destination
|
|
||||||
}
|
|
||||||
|
|
||||||
merge(
|
|
||||||
[{ a: true }],
|
|
||||||
[{ b: true }, 'ah yup'],
|
|
||||||
{ arrayMerge: combineMerge }
|
|
||||||
) // => [{ a: true, b: true }, 'ah yup']
|
|
||||||
```
|
|
||||||
|
|
||||||
### `isMergeableObject`
|
|
||||||
|
|
||||||
By default, deepmerge clones every property from almost every kind of object.
|
|
||||||
|
|
||||||
You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties.
|
|
||||||
|
|
||||||
You can accomplish this by passing in a function for the `isMergeableObject` option.
|
|
||||||
|
|
||||||
If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const isPlainObject = require('is-plain-object')
|
|
||||||
|
|
||||||
function SuperSpecial() {
|
|
||||||
this.special = 'oh yeah man totally'
|
|
||||||
}
|
|
||||||
|
|
||||||
const instantiatedSpecialObject = new SuperSpecial()
|
|
||||||
|
|
||||||
const target = {
|
|
||||||
someProperty: {
|
|
||||||
cool: 'oh for sure'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const source = {
|
|
||||||
someProperty: instantiatedSpecialObject
|
|
||||||
}
|
|
||||||
|
|
||||||
const defaultOutput = merge(target, source)
|
|
||||||
|
|
||||||
defaultOutput.someProperty.cool // => 'oh for sure'
|
|
||||||
defaultOutput.someProperty.special // => 'oh yeah man totally'
|
|
||||||
defaultOutput.someProperty instanceof SuperSpecial // => false
|
|
||||||
|
|
||||||
const customMergeOutput = merge(target, source, {
|
|
||||||
isMergeableObject: isPlainObject
|
|
||||||
})
|
|
||||||
|
|
||||||
customMergeOutput.someProperty.cool // => undefined
|
|
||||||
customMergeOutput.someProperty.special // => 'oh yeah man totally'
|
|
||||||
customMergeOutput.someProperty instanceof SuperSpecial // => true
|
|
||||||
```
|
|
||||||
|
|
||||||
### `customMerge`
|
|
||||||
|
|
||||||
Specifies a function which can be used to override the default merge behavior for a property, based on the property name.
|
|
||||||
|
|
||||||
The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property.
|
|
||||||
|
|
||||||
It may also return undefined, in which case the default merge behaviour will be used.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const alex = {
|
|
||||||
name: {
|
|
||||||
first: 'Alex',
|
|
||||||
last: 'Alexson'
|
|
||||||
},
|
|
||||||
pets: ['Cat', 'Parrot']
|
|
||||||
}
|
|
||||||
|
|
||||||
const tony = {
|
|
||||||
name: {
|
|
||||||
first: 'Tony',
|
|
||||||
last: 'Tonison'
|
|
||||||
},
|
|
||||||
pets: ['Dog']
|
|
||||||
}
|
|
||||||
|
|
||||||
const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}`
|
|
||||||
|
|
||||||
const options = {
|
|
||||||
customMerge: (key) => {
|
|
||||||
if (key === 'name') {
|
|
||||||
return mergeNames
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = merge(alex, tony, options)
|
|
||||||
|
|
||||||
result.name // => 'Alex and Tony'
|
|
||||||
result.pets // => ['Cat', 'Parrot', 'Dog']
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### `clone`
|
|
||||||
|
|
||||||
*Deprecated.*
|
|
||||||
|
|
||||||
Defaults to `true`.
|
|
||||||
|
|
||||||
If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x.
|
|
||||||
|
|
||||||
|
|
||||||
# Testing
|
|
||||||
|
|
||||||
With [npm](http://npmjs.org) do:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm test
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
MIT
|
|
22
node_modules/deepmerge/rollup.config.js
generated
vendored
22
node_modules/deepmerge/rollup.config.js
generated
vendored
@ -1,22 +0,0 @@
|
|||||||
import resolve from 'rollup-plugin-node-resolve'
|
|
||||||
import commonjs from 'rollup-plugin-commonjs'
|
|
||||||
import pkg from './package.json'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
input: `index.js`,
|
|
||||||
plugins: [
|
|
||||||
commonjs(),
|
|
||||||
resolve(),
|
|
||||||
],
|
|
||||||
output: [
|
|
||||||
{
|
|
||||||
file: pkg.main,
|
|
||||||
format: `cjs`
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'deepmerge',
|
|
||||||
file: 'dist/umd.js',
|
|
||||||
format: `umd`
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
|
3
node_modules/url-template/.gitmodules
generated
vendored
3
node_modules/url-template/.gitmodules
generated
vendored
@ -1,3 +0,0 @@
|
|||||||
[submodule "uritemplate-test"]
|
|
||||||
path = uritemplate-test
|
|
||||||
url = https://github.com/uri-templates/uritemplate-test
|
|
1
node_modules/url-template/.npmignore
generated
vendored
1
node_modules/url-template/.npmignore
generated
vendored
@ -1 +0,0 @@
|
|||||||
/node_modules/
|
|
25
node_modules/url-template/LICENSE
generated
vendored
25
node_modules/url-template/LICENSE
generated
vendored
@ -1,25 +0,0 @@
|
|||||||
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.
|
|
32
node_modules/url-template/README.md
generated
vendored
32
node_modules/url-template/README.md
generated
vendored
@ -1,32 +0,0 @@
|
|||||||
## A JavaScript URI template implementation
|
|
||||||
|
|
||||||
This is a simple URI template implementation following the [RFC 6570 URI Template specification](http://tools.ietf.org/html/rfc6570). The implementation supports all levels defined in the specification and is extensively tested.
|
|
||||||
|
|
||||||
## Installation
|
|
||||||
|
|
||||||
For use with Node.js you can install it through npm:
|
|
||||||
|
|
||||||
$ npm install url-template
|
|
||||||
|
|
||||||
If you want to use it in a browser, copy `lib/url-template.js` into your project and use the global `urltemplate` instance. Alternatively you can use [Bower](http://bower.io/) to install this package:
|
|
||||||
|
|
||||||
$ bower install url-template
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
var template = require('url-template');
|
|
||||||
|
|
||||||
...
|
|
||||||
|
|
||||||
var emailUrl = template.parse('/{email}/{folder}/{id}');
|
|
||||||
|
|
||||||
// Returns '/user@domain/test/42'
|
|
||||||
emailUrl.expand({
|
|
||||||
email: 'user@domain',
|
|
||||||
folder: 'test',
|
|
||||||
id: 42
|
|
||||||
});
|
|
||||||
|
|
||||||
## A note on error handling and reporting
|
|
||||||
|
|
||||||
The RFC states that errors in the templates could optionally be handled and reported to the user. This implementation takes a slightly different approach in that it tries to do a best effort template expansion and leaves erroneous expressions in the returned URI instead of throwing errors. So for example, the incorrect expression `{unclosed` will return `{unclosed` as output. The leaves incorrect URLs to be handled by your URL library of choice.
|
|
192
node_modules/url-template/lib/url-template.js
generated
vendored
192
node_modules/url-template/lib/url-template.js
generated
vendored
@ -1,192 +0,0 @@
|
|||||||
(function (root, factory) {
|
|
||||||
if (typeof exports === 'object') {
|
|
||||||
module.exports = factory();
|
|
||||||
} else if (typeof define === 'function' && define.amd) {
|
|
||||||
define([], factory);
|
|
||||||
} else {
|
|
||||||
root.urltemplate = factory();
|
|
||||||
}
|
|
||||||
}(this, function () {
|
|
||||||
/**
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
function UrlTemplate() {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {string} str
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.encodeReserved = function (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('');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {string} str
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.encodeUnreserved = function (str) {
|
|
||||||
return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
|
|
||||||
return '%' + c.charCodeAt(0).toString(16).toUpperCase();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {string} operator
|
|
||||||
* @param {string} value
|
|
||||||
* @param {string} key
|
|
||||||
* @return {string}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.encodeValue = function (operator, value, key) {
|
|
||||||
value = (operator === '+' || operator === '#') ? this.encodeReserved(value) : this.encodeUnreserved(value);
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
return this.encodeUnreserved(key) + '=' + value;
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {*} value
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.isDefined = function (value) {
|
|
||||||
return value !== undefined && value !== null;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {string}
|
|
||||||
* @return {boolean}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.isKeyOperator = function (operator) {
|
|
||||||
return operator === ';' || operator === '&' || operator === '?';
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @param {Object} context
|
|
||||||
* @param {string} operator
|
|
||||||
* @param {string} key
|
|
||||||
* @param {string} modifier
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.getValues = function (context, operator, key, modifier) {
|
|
||||||
var value = context[key],
|
|
||||||
result = [];
|
|
||||||
|
|
||||||
if (this.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(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
|
|
||||||
} else {
|
|
||||||
if (modifier === '*') {
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.filter(this.isDefined).forEach(function (value) {
|
|
||||||
result.push(this.encodeValue(operator, value, this.isKeyOperator(operator) ? key : null));
|
|
||||||
}, this);
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach(function (k) {
|
|
||||||
if (this.isDefined(value[k])) {
|
|
||||||
result.push(this.encodeValue(operator, value[k], k));
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var tmp = [];
|
|
||||||
|
|
||||||
if (Array.isArray(value)) {
|
|
||||||
value.filter(this.isDefined).forEach(function (value) {
|
|
||||||
tmp.push(this.encodeValue(operator, value));
|
|
||||||
}, this);
|
|
||||||
} else {
|
|
||||||
Object.keys(value).forEach(function (k) {
|
|
||||||
if (this.isDefined(value[k])) {
|
|
||||||
tmp.push(this.encodeUnreserved(k));
|
|
||||||
tmp.push(this.encodeValue(operator, value[k].toString()));
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isKeyOperator(operator)) {
|
|
||||||
result.push(this.encodeUnreserved(key) + '=' + tmp.join(','));
|
|
||||||
} else if (tmp.length !== 0) {
|
|
||||||
result.push(tmp.join(','));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (operator === ';') {
|
|
||||||
if (this.isDefined(value)) {
|
|
||||||
result.push(this.encodeUnreserved(key));
|
|
||||||
}
|
|
||||||
} else if (value === '' && (operator === '&' || operator === '?')) {
|
|
||||||
result.push(this.encodeUnreserved(key) + '=');
|
|
||||||
} else if (value === '') {
|
|
||||||
result.push('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {string} template
|
|
||||||
* @return {function(Object):string}
|
|
||||||
*/
|
|
||||||
UrlTemplate.prototype.parse = function (template) {
|
|
||||||
var that = this;
|
|
||||||
var operators = ['+', '#', '.', '/', ';', '?', '&'];
|
|
||||||
|
|
||||||
return {
|
|
||||||
expand: function (context) {
|
|
||||||
return template.replace(/\{([^\{\}]+)\}|([^\{\}]+)/g, function (_, expression, literal) {
|
|
||||||
if (expression) {
|
|
||||||
var operator = null,
|
|
||||||
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.apply(values, that.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 that.encodeReserved(literal);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
return new UrlTemplate();
|
|
||||||
}));
|
|
69
node_modules/url-template/package.json
generated
vendored
69
node_modules/url-template/package.json
generated
vendored
@ -1,69 +0,0 @@
|
|||||||
{
|
|
||||||
"_args": [
|
|
||||||
[
|
|
||||||
"url-template@2.0.8",
|
|
||||||
"/home/svenstaro/prj/upload-release-action"
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"_from": "url-template@2.0.8",
|
|
||||||
"_id": "url-template@2.0.8",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha1-/FZaPMy/93MMd19WQflVV5FDnyE=",
|
|
||||||
"_location": "/url-template",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "url-template@2.0.8",
|
|
||||||
"name": "url-template",
|
|
||||||
"escapedName": "url-template",
|
|
||||||
"rawSpec": "2.0.8",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "2.0.8"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"/@octokit/endpoint",
|
|
||||||
"/@octokit/rest"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz",
|
|
||||||
"_spec": "2.0.8",
|
|
||||||
"_where": "/home/svenstaro/prj/upload-release-action",
|
|
||||||
"author": {
|
|
||||||
"name": "Bram Stein",
|
|
||||||
"email": "b.l.stein@gmail.com",
|
|
||||||
"url": "http://www.bramstein.com"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/bramstein/url-template/issues"
|
|
||||||
},
|
|
||||||
"decription": "A URI template implementation (RFC 6570 compliant)",
|
|
||||||
"description": "This is a simple URI template implementation following the [RFC 6570 URI Template specification](http://tools.ietf.org/html/rfc6570). The implementation supports all levels defined in the specification and is extensively tested.",
|
|
||||||
"devDependencies": {
|
|
||||||
"expect.js": "=0.2.0",
|
|
||||||
"mocha": "=1.6.0"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "./lib"
|
|
||||||
},
|
|
||||||
"homepage": "https://github.com/bramstein/url-template#readme",
|
|
||||||
"keywords": [
|
|
||||||
"uri-template",
|
|
||||||
"uri template",
|
|
||||||
"uri",
|
|
||||||
"url",
|
|
||||||
"rfc 6570",
|
|
||||||
"url template",
|
|
||||||
"url-template"
|
|
||||||
],
|
|
||||||
"license": "BSD",
|
|
||||||
"main": "./lib/url-template.js",
|
|
||||||
"name": "url-template",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git://github.com/bramstein/url-template.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "mocha --reporter spec"
|
|
||||||
},
|
|
||||||
"version": "2.0.8"
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user