Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/request

Package Overview
Dependencies
Maintainers
4
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/request - npm Package Compare versions

Comparing version 6.2.4 to 6.2.5

dist-node/index.js.map

158

dist-node/index.js

@@ -1,15 +0,48 @@

'use strict';
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
Object.defineProperty(exports, '__esModule', { value: true });
// pkg/dist-src/index.js
var dist_src_exports = {};
__export(dist_src_exports, {
request: () => request
});
module.exports = __toCommonJS(dist_src_exports);
var import_endpoint = require("@octokit/endpoint");
var import_universal_user_agent = require("universal-user-agent");
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
// pkg/dist-src/version.js
var VERSION = "6.2.5";
var endpoint = require('@octokit/endpoint');
var universalUserAgent = require('universal-user-agent');
var isPlainObject = require('is-plain-object');
var nodeFetch = _interopDefault(require('node-fetch'));
var requestError = require('@octokit/request-error');
// pkg/dist-src/fetch-wrapper.js
var import_is_plain_object = require("is-plain-object");
var import_node_fetch = __toESM(require("node-fetch"));
var import_request_error = require("@octokit/request-error");
const VERSION = "6.2.4";
// pkg/dist-src/get-buffer-response.js
function getBufferResponse(response) {

@@ -19,5 +52,6 @@ return response.arrayBuffer();

// pkg/dist-src/fetch-wrapper.js
function fetchWrapper(requestOptions) {
const log = requestOptions.request && requestOptions.request.log ? requestOptions.request.log : console;
if (isPlainObject.isPlainObject(requestOptions.body) || Array.isArray(requestOptions.body)) {
if ((0, import_is_plain_object.isPlainObject)(requestOptions.body) || Array.isArray(requestOptions.body)) {
requestOptions.body = JSON.stringify(requestOptions.body);

@@ -28,17 +62,21 @@ }

let url;
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */nodeFetch;
return fetch(requestOptions.url, Object.assign({
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect,
// duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
...(requestOptions.body && {
duplex: "half"
})
},
// `requestOptions.request.agent` type is incompatible
// see https://github.com/octokit/types.ts/pull/264
requestOptions.request)).then(async response => {
const fetch = requestOptions.request && requestOptions.request.fetch || globalThis.fetch || /* istanbul ignore next */
import_node_fetch.default;
return fetch(
requestOptions.url,
Object.assign(
{
method: requestOptions.method,
body: requestOptions.body,
headers: requestOptions.headers,
redirect: requestOptions.redirect,
// duplex must be set if request.body is ReadableStream or Async Iterables.
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
...requestOptions.body && { duplex: "half" }
},
// `requestOptions.request.agent` type is incompatible
// see https://github.com/octokit/types.ts/pull/264
requestOptions.request
)
).then(async (response) => {
url = response.url;

@@ -52,3 +90,5 @@ status = response.status;

const deprecationLink = matches && matches.pop();
log.warn(`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`);
log.warn(
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${headers.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
);
}

@@ -58,3 +98,2 @@ if (status === 204 || status === 205) {

}
// GitHub API returns 200 for HEAD requests
if (requestOptions.method === "HEAD") {

@@ -64,3 +103,3 @@ if (status < 400) {

}
throw new requestError.RequestError(response.statusText, status, {
throw new import_request_error.RequestError(response.statusText, status, {
response: {

@@ -70,3 +109,3 @@ url,

headers,
data: undefined
data: void 0
},

@@ -77,3 +116,3 @@ request: requestOptions

if (status === 304) {
throw new requestError.RequestError("Not modified", status, {
throw new import_request_error.RequestError("Not modified", status, {
response: {

@@ -90,3 +129,3 @@ url,

const data = await getResponseData(response);
const error = new requestError.RequestError(toErrorMessage(data), status, {
const error = new import_request_error.RequestError(toErrorMessage(data), status, {
response: {

@@ -103,3 +142,3 @@ url,

return getResponseData(response);
}).then(data => {
}).then((data) => {
return {

@@ -111,5 +150,8 @@ status,

};
}).catch(error => {
if (error instanceof requestError.RequestError) throw error;else if (error.name === "AbortError") throw error;
throw new requestError.RequestError(error.message, 500, {
}).catch((error) => {
if (error instanceof import_request_error.RequestError)
throw error;
else if (error.name === "AbortError")
throw error;
throw new import_request_error.RequestError(error.message, 500, {
request: requestOptions

@@ -130,4 +172,4 @@ });

function toErrorMessage(data) {
if (typeof data === "string") return data;
// istanbul ignore else - just in case
if (typeof data === "string")
return data;
if ("message" in data) {

@@ -139,35 +181,39 @@ if (Array.isArray(data.errors)) {

}
// istanbul ignore next - just in case
return `Unknown error: ${JSON.stringify(data)}`;
}
// pkg/dist-src/with-defaults.js
function withDefaults(oldEndpoint, newDefaults) {
const endpoint = oldEndpoint.defaults(newDefaults);
const newApi = function (route, parameters) {
const endpointOptions = endpoint.merge(route, parameters);
const endpoint2 = oldEndpoint.defaults(newDefaults);
const newApi = function(route, parameters) {
const endpointOptions = endpoint2.merge(route, parameters);
if (!endpointOptions.request || !endpointOptions.request.hook) {
return fetchWrapper(endpoint.parse(endpointOptions));
return fetchWrapper(endpoint2.parse(endpointOptions));
}
const request = (route, parameters) => {
return fetchWrapper(endpoint.parse(endpoint.merge(route, parameters)));
const request2 = (route2, parameters2) => {
return fetchWrapper(
endpoint2.parse(endpoint2.merge(route2, parameters2))
);
};
Object.assign(request, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
Object.assign(request2, {
endpoint: endpoint2,
defaults: withDefaults.bind(null, endpoint2)
});
return endpointOptions.request.hook(request, endpointOptions);
return endpointOptions.request.hook(request2, endpointOptions);
};
return Object.assign(newApi, {
endpoint,
defaults: withDefaults.bind(null, endpoint)
endpoint: endpoint2,
defaults: withDefaults.bind(null, endpoint2)
});
}
const request = withDefaults(endpoint.endpoint, {
// pkg/dist-src/index.js
var request = withDefaults(import_endpoint.endpoint, {
headers: {
"user-agent": `octokit-request.js/${VERSION} ${universalUserAgent.getUserAgent()}`
"user-agent": `octokit-request.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`
}
});
exports.request = request;
//# sourceMappingURL=index.js.map
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
request
});
{
"name": "@octokit/request",
"version": "6.2.5",
"publishConfig": {
"access": "public"
},
"description": "Send parameterized requests to GitHub's APIs with sensible defaults in browsers and Node",
"version": "6.2.4",
"license": "MIT",
"files": [
"dist-*/",
"bin/"
],
"source": "dist-src/index.js",
"types": "dist-types/index.d.ts",
"main": "dist-node/index.js",
"module": "dist-web/index.js",
"pika": true,
"sideEffects": false,
"repository": "github:octokit/request.js",
"keywords": [

@@ -22,3 +15,4 @@ "octokit",

],
"repository": "github:octokit/request.js",
"author": "Gregor Martynus (https://github.com/gr2m)",
"license": "MIT",
"dependencies": {

@@ -34,6 +28,3 @@ "@octokit/endpoint": "^7.0.0",

"@octokit/auth-app": "^4.0.0",
"@pika/pack": "^0.3.7",
"@pika/plugin-build-node": "^0.9.0",
"@pika/plugin-build-web": "^0.9.0",
"@pika/plugin-ts-standard-pkg": "^0.9.0",
"@octokit/tsconfig": "^1.0.2",
"@types/fetch-mock": "^7.2.4",

@@ -45,3 +36,5 @@ "@types/jest": "^29.0.0",

"@types/once": "^1.4.0",
"esbuild": "^0.17.19",
"fetch-mock": "^9.3.1",
"glob": "^10.2.4",
"jest": "^29.0.0",

@@ -58,5 +51,11 @@ "lolex": "^6.0.0",

},
"publishConfig": {
"access": "public"
}
"files": [
"dist-*/**",
"bin/**"
],
"main": "dist-node/index.js",
"browser": "dist-web/index.js",
"types": "dist-types/index.d.ts",
"module": "dist-src/index.js",
"sideEffects": false
}
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