@@ -4305,7 +4305,7 @@ module.exports = __toCommonJS(dist_src_exports);
4305
4305
var import_universal_user_agent = __nccwpck_require__ ( 3843 ) ;
4306
4306
4307
4307
// pkg/dist-src/version.js
4308
- var VERSION = "9.0.0 " ;
4308
+ var VERSION = "9.0.6 " ;
4309
4309
4310
4310
// pkg/dist-src/defaults.js
4311
4311
var userAgent = `octokit-endpoint.js/${ VERSION } ${ ( 0 , import_universal_user_agent . getUserAgent ) ( ) } ` ;
@@ -4332,12 +4332,24 @@ function lowercaseKeys(object) {
4332
4332
} , { } ) ;
4333
4333
}
4334
4334
4335
+ // pkg/dist-src/util/is-plain-object.js
4336
+ function isPlainObject ( value ) {
4337
+ if ( typeof value !== "object" || value === null )
4338
+ return false ;
4339
+ if ( Object . prototype . toString . call ( value ) !== "[object Object]" )
4340
+ return false ;
4341
+ const proto = Object . getPrototypeOf ( value ) ;
4342
+ if ( proto === null )
4343
+ return true ;
4344
+ const Ctor = Object . prototype . hasOwnProperty . call ( proto , "constructor" ) && proto . constructor ;
4345
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function . prototype . call ( Ctor ) === Function . prototype . call ( value ) ;
4346
+ }
4347
+
4335
4348
// pkg/dist-src/util/merge-deep.js
4336
- var import_is_plain_object = __nccwpck_require__ ( 3407 ) ;
4337
4349
function mergeDeep ( defaults , options ) {
4338
4350
const result = Object . assign ( { } , defaults ) ;
4339
4351
Object . keys ( options ) . forEach ( ( key ) => {
4340
- if ( ( 0 , import_is_plain_object . isPlainObject ) ( options [ key ] ) ) {
4352
+ if ( isPlainObject ( options [ key ] ) ) {
4341
4353
if ( ! ( key in defaults ) )
4342
4354
Object . assign ( result , { [ key ] : options [ key ] } ) ;
4343
4355
else
@@ -4398,9 +4410,9 @@ function addQueryParameters(url, parameters) {
4398
4410
}
4399
4411
4400
4412
// pkg/dist-src/util/extract-url-variable-names.js
4401
- var urlVariableRegex = / \{ [ ^ } ] + \} / g;
4413
+ var urlVariableRegex = / \{ [ ^ { } } ] + \} / g;
4402
4414
function removeNonChars ( variableName ) {
4403
- return variableName . replace ( / ^ \W + | \W + $ / g, "" ) . split ( / , / ) ;
4415
+ return variableName . replace ( / (?: ^ \W + ) | (?: (?< ! \W ) \W + $ ) / g, "" ) . split ( / , / ) ;
4404
4416
}
4405
4417
function extractUrlVariableNames ( url ) {
4406
4418
const matches = url . match ( urlVariableRegex ) ;
@@ -4412,10 +4424,13 @@ function extractUrlVariableNames(url) {
4412
4424
4413
4425
// pkg/dist-src/util/omit.js
4414
4426
function omit ( object , keysToOmit ) {
4415
- return Object . keys ( object ) . filter ( ( option ) => ! keysToOmit . includes ( option ) ) . reduce ( ( obj , key ) => {
4416
- obj [ key ] = object [ key ] ;
4417
- return obj ;
4418
- } , { } ) ;
4427
+ const result = { __proto__ : null } ;
4428
+ for ( const key of Object . keys ( object ) ) {
4429
+ if ( keysToOmit . indexOf ( key ) === - 1 ) {
4430
+ result [ key ] = object [ key ] ;
4431
+ }
4432
+ }
4433
+ return result ;
4419
4434
}
4420
4435
4421
4436
// pkg/dist-src/util/url-template.js
@@ -4513,7 +4528,7 @@ function parseUrl(template) {
4513
4528
}
4514
4529
function expand ( template , context ) {
4515
4530
var operators = [ "+" , "#" , "." , "/" , ";" , "?" , "&" ] ;
4516
- return template . replace (
4531
+ template = template . replace (
4517
4532
/ \{ ( [ ^ \{ \} ] + ) \} | ( [ ^ \{ \} ] + ) / g,
4518
4533
function ( _ , expression , literal ) {
4519
4534
if ( expression ) {
@@ -4543,6 +4558,11 @@ function expand(template, context) {
4543
4558
}
4544
4559
}
4545
4560
) ;
4561
+ if ( template === "/" ) {
4562
+ return template ;
4563
+ } else {
4564
+ return template . replace ( / \/ $ / , "" ) ;
4565
+ }
4546
4566
}
4547
4567
4548
4568
// pkg/dist-src/parse.js
@@ -4578,7 +4598,7 @@ function parse(options) {
4578
4598
}
4579
4599
if ( url . endsWith ( "/graphql" ) ) {
4580
4600
if ( options . mediaType . previews ?. length ) {
4581
- const previewsFromAcceptHeader = headers . accept . match ( / [ \w - ] + (? = - p r e v i e w ) / g) || [ ] ;
4601
+ const previewsFromAcceptHeader = headers . accept . match ( / (?< ! [ \w - ] ) [ \w - ] + (? = - p r e v i e w ) / g) || [ ] ;
4582
4602
headers . accept = previewsFromAcceptHeader . concat ( options . mediaType . previews ) . map ( ( preview ) => {
4583
4603
const format = options . mediaType . format ? `.${ options . mediaType . format } ` : "+json" ;
4584
4604
return `application/vnd.github.${ preview } -preview${ format } ` ;
@@ -7390,10 +7410,22 @@ var import_endpoint = __nccwpck_require__(4471);
7390
7410
var import_universal_user_agent = __nccwpck_require__ ( 3843 ) ;
7391
7411
7392
7412
// pkg/dist-src/version.js
7393
- var VERSION = "8.1.1" ;
7413
+ var VERSION = "8.4.1" ;
7414
+
7415
+ // pkg/dist-src/is-plain-object.js
7416
+ function isPlainObject ( value ) {
7417
+ if ( typeof value !== "object" || value === null )
7418
+ return false ;
7419
+ if ( Object . prototype . toString . call ( value ) !== "[object Object]" )
7420
+ return false ;
7421
+ const proto = Object . getPrototypeOf ( value ) ;
7422
+ if ( proto === null )
7423
+ return true ;
7424
+ const Ctor = Object . prototype . hasOwnProperty . call ( proto , "constructor" ) && proto . constructor ;
7425
+ return typeof Ctor === "function" && Ctor instanceof Ctor && Function . prototype . call ( Ctor ) === Function . prototype . call ( value ) ;
7426
+ }
7394
7427
7395
7428
// pkg/dist-src/fetch-wrapper.js
7396
- var import_is_plain_object = __nccwpck_require__ ( 3407 ) ;
7397
7429
var import_request_error = __nccwpck_require__ ( 3708 ) ;
7398
7430
7399
7431
// pkg/dist-src/get-buffer-response.js
@@ -7403,10 +7435,10 @@ function getBufferResponse(response) {
7403
7435
7404
7436
// pkg/dist-src/fetch-wrapper.js
7405
7437
function fetchWrapper ( requestOptions ) {
7406
- var _a , _b , _c ;
7438
+ var _a , _b , _c , _d ;
7407
7439
const log = requestOptions . request && requestOptions . request . log ? requestOptions . request . log : console ;
7408
7440
const parseSuccessResponseBody = ( ( _a = requestOptions . request ) == null ? void 0 : _a . parseSuccessResponseBody ) !== false ;
7409
- if ( ( 0 , import_is_plain_object . isPlainObject ) ( requestOptions . body ) || Array . isArray ( requestOptions . body ) ) {
7441
+ if ( isPlainObject ( requestOptions . body ) || Array . isArray ( requestOptions . body ) ) {
7410
7442
requestOptions . body = JSON . stringify ( requestOptions . body ) ;
7411
7443
}
7412
7444
let headers = { } ;
@@ -7424,8 +7456,9 @@ function fetchWrapper(requestOptions) {
7424
7456
return fetch ( requestOptions . url , {
7425
7457
method : requestOptions . method ,
7426
7458
body : requestOptions . body ,
7459
+ redirect : ( _c = requestOptions . request ) == null ? void 0 : _c . redirect ,
7427
7460
headers : requestOptions . headers ,
7428
- signal : ( _c = requestOptions . request ) == null ? void 0 : _c . signal ,
7461
+ signal : ( _d = requestOptions . request ) == null ? void 0 : _d . signal ,
7429
7462
// duplex must be set if request.body is ReadableStream or Async Iterables.
7430
7463
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
7431
7464
...requestOptions . body && { duplex : "half" }
@@ -7436,7 +7469,7 @@ function fetchWrapper(requestOptions) {
7436
7469
headers [ keyAndValue [ 0 ] ] = keyAndValue [ 1 ] ;
7437
7470
}
7438
7471
if ( "deprecation" in headers ) {
7439
- const matches = headers . link && headers . link . match ( / < ( [ ^ > ] + ) > ; r e l = " d e p r e c a t i o n " / ) ;
7472
+ const matches = headers . link && headers . link . match ( / < ( [ ^ < > ] + ) > ; r e l = " d e p r e c a t i o n " / ) ;
7440
7473
const deprecationLink = matches && matches . pop ( ) ;
7441
7474
log . warn (
7442
7475
`[@octokit/request] "${ requestOptions . method } ${ requestOptions . url } " is deprecated. It is scheduled to be removed on ${ headers . sunset } ${ deprecationLink ? `. See ${ deprecationLink } ` : "" } `
@@ -7496,15 +7529,23 @@ function fetchWrapper(requestOptions) {
7496
7529
throw error ;
7497
7530
else if ( error . name === "AbortError" )
7498
7531
throw error ;
7499
- throw new import_request_error . RequestError ( error . message , 500 , {
7532
+ let message = error . message ;
7533
+ if ( error . name === "TypeError" && "cause" in error ) {
7534
+ if ( error . cause instanceof Error ) {
7535
+ message = error . cause . message ;
7536
+ } else if ( typeof error . cause === "string" ) {
7537
+ message = error . cause ;
7538
+ }
7539
+ }
7540
+ throw new import_request_error . RequestError ( message , 500 , {
7500
7541
request : requestOptions
7501
7542
} ) ;
7502
7543
} ) ;
7503
7544
}
7504
7545
async function getResponseData ( response ) {
7505
7546
const contentType = response . headers . get ( "content-type" ) ;
7506
7547
if ( / a p p l i c a t i o n \/ j s o n / . test ( contentType ) ) {
7507
- return response . json ( ) ;
7548
+ return response . json ( ) . catch ( ( ) => response . text ( ) ) . catch ( ( ) => "" ) ;
7508
7549
}
7509
7550
if ( ! contentType || / ^ t e x t \/ | c h a r s e t = u t f - 8 $ / . test ( contentType ) ) {
7510
7551
return response . text ( ) ;
@@ -7514,11 +7555,17 @@ async function getResponseData(response) {
7514
7555
function toErrorMessage ( data ) {
7515
7556
if ( typeof data === "string" )
7516
7557
return data ;
7558
+ let suffix ;
7559
+ if ( "documentation_url" in data ) {
7560
+ suffix = ` - ${ data . documentation_url } ` ;
7561
+ } else {
7562
+ suffix = "" ;
7563
+ }
7517
7564
if ( "message" in data ) {
7518
7565
if ( Array . isArray ( data . errors ) ) {
7519
- return `${ data . message } : ${ data . errors . map ( JSON . stringify ) . join ( ", " ) } ` ;
7566
+ return `${ data . message } : ${ data . errors . map ( JSON . stringify ) . join ( ", " ) } ${ suffix } ` ;
7520
7567
}
7521
- return data . message ;
7568
+ return ` ${ data . message } ${ suffix } ` ;
7522
7569
}
7523
7570
return `Unknown error: ${ JSON . stringify ( data ) } ` ;
7524
7571
}
@@ -7818,52 +7865,6 @@ class Deprecation extends Error {
7818
7865
exports . Deprecation = Deprecation ;
7819
7866
7820
7867
7821
- /***/ } ) ,
7822
-
7823
- /***/ 3407 :
7824
- /***/ ( ( __unused_webpack_module , exports ) => {
7825
-
7826
- "use strict" ;
7827
-
7828
-
7829
- Object . defineProperty ( exports , "__esModule" , ( { value : true } ) ) ;
7830
-
7831
- /*!
7832
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
7833
- *
7834
- * Copyright (c) 2014-2017, Jon Schlinkert.
7835
- * Released under the MIT License.
7836
- */
7837
-
7838
- function isObject ( o ) {
7839
- return Object . prototype . toString . call ( o ) === '[object Object]' ;
7840
- }
7841
-
7842
- function isPlainObject ( o ) {
7843
- var ctor , prot ;
7844
-
7845
- if ( isObject ( o ) === false ) return false ;
7846
-
7847
- // If has modified constructor
7848
- ctor = o . constructor ;
7849
- if ( ctor === undefined ) return true ;
7850
-
7851
- // If has modified prototype
7852
- prot = ctor . prototype ;
7853
- if ( isObject ( prot ) === false ) return false ;
7854
-
7855
- // If constructor does not have an Object-specific method
7856
- if ( prot . hasOwnProperty ( 'isPrototypeOf' ) === false ) {
7857
- return false ;
7858
- }
7859
-
7860
- // Most likely a plain Object
7861
- return true ;
7862
- }
7863
-
7864
- exports . isPlainObject = isPlainObject ;
7865
-
7866
-
7867
7868
/***/ } ) ,
7868
7869
7869
7870
/***/ 5560 :
0 commit comments