Socket
Socket
Sign inDemoInstall

@octokit/endpoint

Package Overview
Dependencies
Maintainers
3
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/endpoint - npm Package Compare versions

Comparing version 5.5.3 to 6.0.0

2

dist-node/index.js

@@ -358,3 +358,3 @@ 'use strict';

const VERSION = "5.5.3";
const VERSION = "6.0.0";

@@ -361,0 +361,0 @@ const userAgent = `octokit-endpoint.js/${VERSION} ${universalUserAgent.getUserAgent()}`; // DEFAULTS has all properties set that EndpointOptions has, except url.

@@ -11,8 +11,8 @@ import { getUserAgent } from "universal-user-agent";

accept: "application/vnd.github.v3+json",
"user-agent": userAgent
"user-agent": userAgent,
},
mediaType: {
format: "",
previews: []
}
previews: [],
},
};

@@ -17,3 +17,3 @@ import { lowercaseKeys } from "./util/lowercase-keys";

mergedOptions.mediaType.previews = defaults.mediaType.previews
.filter(preview => !mergedOptions.mediaType.previews.includes(preview))
.filter((preview) => !mergedOptions.mediaType.previews.includes(preview))
.concat(mergedOptions.mediaType.previews);

@@ -20,0 +20,0 @@ }

@@ -18,3 +18,3 @@ import { addQueryParameters } from "./util/add-query-parameters";

"request",
"mediaType"
"mediaType",
]);

@@ -28,3 +28,3 @@ // extract variable names from URL to calculate remaining variables later

const omittedParameters = Object.keys(options)
.filter(option => urlVariableNames.includes(option))
.filter((option) => urlVariableNames.includes(option))
.concat("baseUrl");

@@ -38,3 +38,3 @@ const remainingParameters = omit(parameters, omittedParameters);

.split(/,/)
.map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
.map((preview) => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
.join(",");

@@ -46,3 +46,3 @@ }

.concat(options.mediaType.previews)
.map(preview => {
.map((preview) => {
const format = options.mediaType.format

@@ -49,0 +49,0 @@ ? `.${options.mediaType.format}`

@@ -10,9 +10,5 @@ export function addQueryParameters(url, parameters) {

names
.map(name => {
.map((name) => {
if (name === "q") {
return ("q=" +
parameters
.q.split("+")
.map(encodeURIComponent)
.join("+"));
return ("q=" + parameters.q.split("+").map(encodeURIComponent).join("+"));
}

@@ -19,0 +15,0 @@ return `${name}=${encodeURIComponent(parameters[name])}`;

import isPlainObject from "is-plain-object";
export function mergeDeep(defaults, options) {
const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => {
Object.keys(options).forEach((key) => {
if (isPlainObject(options[key])) {

@@ -6,0 +6,0 @@ if (!(key in defaults))

export function omit(object, keysToOmit) {
return Object.keys(object)
.filter(option => !keysToOmit.includes(option))
.filter((option) => !keysToOmit.includes(option))
.reduce((obj, key) => {

@@ -5,0 +5,0 @@ obj[key] = object[key];

@@ -32,5 +32,3 @@ // Based on https://github.com/bramstein/url-template, licensed under BSD

if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part)
.replace(/%5B/g, "[")
.replace(/%5D/g, "]");
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
}

@@ -43,7 +41,3 @@ return part;

return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return ("%" +
c
.charCodeAt(0)
.toString(16)
.toUpperCase());
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
});

@@ -137,3 +131,3 @@ }

return {
expand: expand.bind(null, template)
expand: expand.bind(null, template),
};

@@ -140,0 +134,0 @@ }

@@ -1,1 +0,1 @@

export const VERSION = "5.5.3";
export const VERSION = "6.0.0";

@@ -11,4 +11,4 @@ import { endpointWithDefaults } from "./endpoint-with-defaults";

merge: merge.bind(null, DEFAULTS),
parse
parse,
});
}

@@ -1,1 +0,1 @@

export declare const VERSION = "5.5.3";
export declare const VERSION = "6.0.0";

@@ -16,3 +16,3 @@ import isPlainObject from 'is-plain-object';

const result = Object.assign({}, defaults);
Object.keys(options).forEach(key => {
Object.keys(options).forEach((key) => {
if (isPlainObject(options[key])) {

@@ -45,3 +45,3 @@ if (!(key in defaults))

mergedOptions.mediaType.previews = defaults.mediaType.previews
.filter(preview => !mergedOptions.mediaType.previews.includes(preview))
.filter((preview) => !mergedOptions.mediaType.previews.includes(preview))
.concat(mergedOptions.mediaType.previews);

@@ -62,9 +62,5 @@ }

names
.map(name => {
.map((name) => {
if (name === "q") {
return ("q=" +
parameters
.q.split("+")
.map(encodeURIComponent)
.join("+"));
return ("q=" + parameters.q.split("+").map(encodeURIComponent).join("+"));
}

@@ -90,3 +86,3 @@ return `${name}=${encodeURIComponent(parameters[name])}`;

return Object.keys(object)
.filter(option => !keysToOmit.includes(option))
.filter((option) => !keysToOmit.includes(option))
.reduce((obj, key) => {

@@ -129,5 +125,3 @@ obj[key] = object[key];

if (!/%[0-9A-Fa-f]/.test(part)) {
part = encodeURI(part)
.replace(/%5B/g, "[")
.replace(/%5D/g, "]");
part = encodeURI(part).replace(/%5B/g, "[").replace(/%5D/g, "]");
}

@@ -140,7 +134,3 @@ return part;

return encodeURIComponent(str).replace(/[!'()*]/g, function (c) {
return ("%" +
c
.charCodeAt(0)
.toString(16)
.toUpperCase());
return "%" + c.charCodeAt(0).toString(16).toUpperCase();
});

@@ -234,3 +224,3 @@ }

return {
expand: expand.bind(null, template)
expand: expand.bind(null, template),
};

@@ -285,3 +275,3 @@ }

"request",
"mediaType"
"mediaType",
]);

@@ -295,3 +285,3 @@ // extract variable names from URL to calculate remaining variables later

const omittedParameters = Object.keys(options)
.filter(option => urlVariableNames.includes(option))
.filter((option) => urlVariableNames.includes(option))
.concat("baseUrl");

@@ -305,3 +295,3 @@ const remainingParameters = omit(parameters, omittedParameters);

.split(/,/)
.map(preview => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
.map((preview) => preview.replace(/application\/vnd(\.\w+)(\.v3)?(\.\w+)?(\+json)?$/, `application/vnd$1$2.${options.mediaType.format}`))
.join(",");

@@ -313,3 +303,3 @@ }

.concat(options.mediaType.previews)
.map(preview => {
.map((preview) => {
const format = options.mediaType.format

@@ -365,7 +355,7 @@ ? `.${options.mediaType.format}`

merge: merge.bind(null, DEFAULTS),
parse
parse,
});
}
const VERSION = "5.5.3";
const VERSION = "6.0.0";

@@ -380,8 +370,8 @@ const userAgent = `octokit-endpoint.js/${VERSION} ${getUserAgent()}`;

accept: "application/vnd.github.v3+json",
"user-agent": userAgent
"user-agent": userAgent,
},
mediaType: {
format: "",
previews: []
}
previews: [],
},
};

@@ -388,0 +378,0 @@

{
"name": "@octokit/endpoint",
"description": "Turns REST API endpoints into generic request options",
"version": "5.5.3",
"version": "6.0.0",
"license": "MIT",

@@ -38,3 +38,3 @@ "files": [

"jest": "^24.7.1",
"prettier": "1.19.0",
"prettier": "2.0.2",
"semantic-release": "^17.0.0",

@@ -41,0 +41,0 @@ "semantic-release-plugin-update-version-in-files": "^1.0.0",

@@ -64,6 +64,6 @@ # endpoint.js

headers: {
authorization: "token 0000000000000000000000000000000000000001"
authorization: "token 0000000000000000000000000000000000000001",
},
org: "octokit",
type: "private"
type: "private",
});

@@ -287,6 +287,6 @@ ```

"user-agent": "myApp/1.2.3",
authorization: `token 0000000000000000000000000000000000000001`
authorization: `token 0000000000000000000000000000000000000001`,
},
org: "my-project",
per_page: 100
per_page: 100,
});

@@ -303,10 +303,10 @@

headers: {
"user-agent": "myApp/1.2.3"
"user-agent": "myApp/1.2.3",
},
org: "my-project"
org: "my-project",
});
const myProjectEndpointWithAuth = myProjectEndpoint.defaults({
headers: {
authorization: `token 0000000000000000000000000000000000000001`
}
authorization: `token 0000000000000000000000000000000000000001`,
},
});

@@ -326,3 +326,3 @@ ```

const myEndpoint = endpoint.defaults({
baseUrl: "https://github-enterprise.acme-inc.com/api/v3"
baseUrl: "https://github-enterprise.acme-inc.com/api/v3",
});

@@ -340,12 +340,12 @@ myEndpoint.DEFAULTS.baseUrl; // https://github-enterprise.acme-inc.com/api/v3

headers: {
"user-agent": "myApp/1.2.3"
"user-agent": "myApp/1.2.3",
},
org: "my-project"
org: "my-project",
});
myProjectEndpoint.merge("GET /orgs/:org/repos", {
headers: {
authorization: `token 0000000000000000000000000000000000000001`
authorization: `token 0000000000000000000000000000000000000001`,
},
org: "my-secret-project",
type: "private"
type: "private",
});

@@ -385,4 +385,4 @@

accept: "text/html;charset=utf-8",
"content-type": "text/plain"
}
"content-type": "text/plain",
},
});

@@ -418,5 +418,5 @@

"content-length": 14,
authorization: `token 0000000000000000000000000000000000000001`
authorization: `token 0000000000000000000000000000000000000001`,
},
data: "Hello, world!"
data: "Hello, world!",
}

@@ -423,0 +423,0 @@ );

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc