@ubiquity-os/plugin-sdk
Version:
SDK for plugin support.
55 lines (53 loc) • 2.49 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/octokit.ts
var octokit_exports = {};
__export(octokit_exports, {
customOctokit: () => customOctokit
});
module.exports = __toCommonJS(octokit_exports);
var import_core = require("@octokit/core");
var import_plugin_paginate_rest = require("@octokit/plugin-paginate-rest");
var import_plugin_rest_endpoint_methods = require("@octokit/plugin-rest-endpoint-methods");
var import_plugin_retry = require("@octokit/plugin-retry");
var import_plugin_throttling = require("@octokit/plugin-throttling");
var import_plugin_paginate_graphql = require("@octokit/plugin-paginate-graphql");
var defaultOptions = {
throttle: {
onAbuseLimit: (retryAfter, options, octokit) => {
octokit.log.warn(`Abuse limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
},
onRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(`Rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
},
onSecondaryRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(`Secondary rate limit hit with "${options.method} ${options.url}", retrying in ${retryAfter} seconds.`);
return true;
}
}
};
var customOctokit = import_core.Octokit.plugin(import_plugin_throttling.throttling, import_plugin_retry.retry, import_plugin_paginate_rest.paginateRest, import_plugin_rest_endpoint_methods.restEndpointMethods, import_plugin_paginate_graphql.paginateGraphQL).defaults((instanceOptions) => {
return { ...defaultOptions, ...instanceOptions };
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
customOctokit
});
;