github-pages-deploy-action/node_modules/@octokit/core/dist-node/index.js.map
2020-06-06 10:11:37 -04:00

1 line
9.7 KiB
Plaintext

{"version":3,"file":"index.js","sources":["../dist-src/version.js","../dist-src/index.js"],"sourcesContent":["export const VERSION = \"2.5.3\";\n","import { getUserAgent } from \"universal-user-agent\";\nimport { Collection } from \"before-after-hook\";\nimport { request } from \"@octokit/request\";\nimport { withCustomRequest } from \"@octokit/graphql\";\nimport { createTokenAuth } from \"@octokit/auth-token\";\nimport { VERSION } from \"./version\";\nlet Octokit = /** @class */ (() => {\n class Octokit {\n constructor(options = {}) {\n const hook = new Collection();\n const requestDefaults = {\n baseUrl: request.endpoint.DEFAULTS.baseUrl,\n headers: {},\n request: Object.assign({}, options.request, {\n hook: hook.bind(null, \"request\"),\n }),\n mediaType: {\n previews: [],\n format: \"\",\n },\n };\n // prepend default user agent with `options.userAgent` if set\n requestDefaults.headers[\"user-agent\"] = [\n options.userAgent,\n `octokit-core.js/${VERSION} ${getUserAgent()}`,\n ]\n .filter(Boolean)\n .join(\" \");\n if (options.baseUrl) {\n requestDefaults.baseUrl = options.baseUrl;\n }\n if (options.previews) {\n requestDefaults.mediaType.previews = options.previews;\n }\n if (options.timeZone) {\n requestDefaults.headers[\"time-zone\"] = options.timeZone;\n }\n this.request = request.defaults(requestDefaults);\n this.graphql = withCustomRequest(this.request).defaults({\n ...requestDefaults,\n baseUrl: requestDefaults.baseUrl.replace(/\\/api\\/v3$/, \"/api\"),\n });\n this.log = Object.assign({\n debug: () => { },\n info: () => { },\n warn: console.warn.bind(console),\n error: console.error.bind(console),\n }, options.log);\n this.hook = hook;\n // (1) If neither `options.authStrategy` nor `options.auth` are set, the `octokit` instance\n // is unauthenticated. The `this.auth()` method is a no-op and no request hook is registred.\n // (2) If only `options.auth` is set, use the default token authentication strategy.\n // (3) If `options.authStrategy` is set then use it and pass in `options.auth`. Always pass own request as many strategies accept a custom request instance.\n // TODO: type `options.auth` based on `options.authStrategy`.\n if (!options.authStrategy) {\n if (!options.auth) {\n // (1)\n this.auth = async () => ({\n type: \"unauthenticated\",\n });\n }\n else {\n // (2)\n const auth = createTokenAuth(options.auth);\n // @ts-ignore ¯\\_(ツ)_/¯\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n }\n else {\n const auth = options.authStrategy(Object.assign({\n request: this.request,\n }, options.auth));\n // @ts-ignore ¯\\_(ツ)_/¯\n hook.wrap(\"request\", auth.hook);\n this.auth = auth;\n }\n // apply plugins\n // https://stackoverflow.com/a/16345172\n const classConstructor = this.constructor;\n classConstructor.plugins.forEach((plugin) => {\n Object.assign(this, plugin(this, options));\n });\n }\n static defaults(defaults) {\n const OctokitWithDefaults = class extends this {\n constructor(...args) {\n const options = args[0] || {};\n super(Object.assign({}, defaults, options, options.userAgent && defaults.userAgent\n ? {\n userAgent: `${options.userAgent} ${defaults.userAgent}`,\n }\n : null));\n }\n };\n return OctokitWithDefaults;\n }\n /**\n * Attach a plugin (or many) to your Octokit instance.\n *\n * @example\n * const API = Octokit.plugin(plugin1, plugin2, plugin3, ...)\n */\n static plugin(p1, ...p2) {\n var _a;\n if (p1 instanceof Array) {\n console.warn([\n \"Passing an array of plugins to Octokit.plugin() has been deprecated.\",\n \"Instead of:\",\n \" Octokit.plugin([plugin1, plugin2, ...])\",\n \"Use:\",\n \" Octokit.plugin(plugin1, plugin2, ...)\",\n ].join(\"\\n\"));\n }\n const currentPlugins = this.plugins;\n let newPlugins = [\n ...(p1 instanceof Array\n ? p1\n : [p1]),\n ...p2,\n ];\n const NewOctokit = (_a = class extends this {\n },\n _a.plugins = currentPlugins.concat(newPlugins.filter((plugin) => !currentPlugins.includes(plugin))),\n _a);\n return NewOctokit;\n }\n }\n Octokit.VERSION = VERSION;\n Octokit.plugins = [];\n return Octokit;\n})();\nexport { Octokit };\n"],"names":["VERSION","Octokit","constructor","options","hook","Collection","requestDefaults","baseUrl","request","endpoint","DEFAULTS","headers","Object","assign","bind","mediaType","previews","format","userAgent","getUserAgent","filter","Boolean","join","timeZone","defaults","graphql","withCustomRequest","replace","log","debug","info","warn","console","error","authStrategy","auth","type","createTokenAuth","wrap","classConstructor","plugins","forEach","plugin","OctokitWithDefaults","args","p1","p2","_a","Array","currentPlugins","newPlugins","NewOctokit","concat","includes"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,OAAO,GAAG,mBAAhB;;ICMHC,OAAO;AAAG;AAAc,CAAC,MAAM;AAC/B,QAAMA,OAAN,CAAc;AACVC,IAAAA,WAAW,CAACC,OAAO,GAAG,EAAX,EAAe;AACtB,YAAMC,IAAI,GAAG,IAAIC,0BAAJ,EAAb;AACA,YAAMC,eAAe,GAAG;AACpBC,QAAAA,OAAO,EAAEC,eAAO,CAACC,QAAR,CAAiBC,QAAjB,CAA0BH,OADf;AAEpBI,QAAAA,OAAO,EAAE,EAFW;AAGpBH,QAAAA,OAAO,EAAEI,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBV,OAAO,CAACK,OAA1B,EAAmC;AACxCJ,UAAAA,IAAI,EAAEA,IAAI,CAACU,IAAL,CAAU,IAAV,EAAgB,SAAhB;AADkC,SAAnC,CAHW;AAMpBC,QAAAA,SAAS,EAAE;AACPC,UAAAA,QAAQ,EAAE,EADH;AAEPC,UAAAA,MAAM,EAAE;AAFD;AANS,OAAxB,CAFsB;;AActBX,MAAAA,eAAe,CAACK,OAAhB,CAAwB,YAAxB,IAAwC,CACpCR,OAAO,CAACe,SAD4B,EAEnC,mBAAkBlB,OAAQ,IAAGmB,+BAAY,EAAG,EAFT,EAInCC,MAJmC,CAI5BC,OAJ4B,EAKnCC,IALmC,CAK9B,GAL8B,CAAxC;;AAMA,UAAInB,OAAO,CAACI,OAAZ,EAAqB;AACjBD,QAAAA,eAAe,CAACC,OAAhB,GAA0BJ,OAAO,CAACI,OAAlC;AACH;;AACD,UAAIJ,OAAO,CAACa,QAAZ,EAAsB;AAClBV,QAAAA,eA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