first commit
This commit is contained in:
24
node_modules/@sapphire/async-queue/LICENSE.md
generated
vendored
Normal file
24
node_modules/@sapphire/async-queue/LICENSE.md
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright © `2020` `The Sapphire Community and its contributors`
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the “Software”), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
104
node_modules/@sapphire/async-queue/README.md
generated
vendored
Normal file
104
node_modules/@sapphire/async-queue/README.md
generated
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
<div align="center">
|
||||
|
||||

|
||||
|
||||
# @sapphire/async-queue
|
||||
|
||||
**Sequential asynchronous lock-based queue for promises.**
|
||||
|
||||
[](https://github.com/sapphiredev/utilities/blob/main/LICENSE.md)
|
||||
[](https://codecov.io/gh/sapphiredev/utilities)
|
||||
[](https://bundlephobia.com/result?p=@sapphire/async-queue)
|
||||
[](https://www.npmjs.com/package/@sapphire/async-queue)
|
||||
|
||||
</div>
|
||||
|
||||
## Description
|
||||
|
||||
Ever needed a queue for a set of promises? This is the package for you.
|
||||
|
||||
## Features
|
||||
|
||||
- Written in TypeScript
|
||||
- Bundled with esbuild so it can be used in NodeJS and browsers
|
||||
- Offers CommonJS, ESM and UMD bundles
|
||||
- Fully tested
|
||||
|
||||
## Installation
|
||||
|
||||
You can use the following command to install this package, or replace `npm install` with your package manager of choice.
|
||||
|
||||
```sh
|
||||
npm install @sapphire/async-queue
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Buy us some doughnuts
|
||||
|
||||
Sapphire Community is and always will be open source, even if we don't get donations. That being said, we know there are amazing people who may still want to donate just to show their appreciation. Thank you very much in advance!
|
||||
|
||||
We accept donations through Open Collective, Ko-fi, PayPal, Patreon and GitHub Sponsorships. You can use the buttons below to donate through your method of choice.
|
||||
|
||||
| Donate With | Address |
|
||||
| :-------------: | :-------------------------------------------------: |
|
||||
| Open Collective | [Click Here](https://sapphirejs.dev/opencollective) |
|
||||
| Ko-fi | [Click Here](https://sapphirejs.dev/kofi) |
|
||||
| Patreon | [Click Here](https://sapphirejs.dev/patreon) |
|
||||
| PayPal | [Click Here](https://sapphirejs.dev/paypal) |
|
||||
|
||||
## Contributors ✨
|
||||
|
||||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
||||
<!-- prettier-ignore-start -->
|
||||
<!-- markdownlint-disable -->
|
||||
<table>
|
||||
<tr>
|
||||
<td align="center"><a href="https://favware.tech/"><img src="https://avatars3.githubusercontent.com/u/4019718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jeroen Claassens</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Code">💻</a> <a href="#infra-favna" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="#projectManagement-favna" title="Project Management">📆</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Documentation">📖</a> <a href="https://github.com/sapphiredev/utilities/commits?author=favna" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/kyranet"><img src="https://avatars0.githubusercontent.com/u/24852502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Antonio Román</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Code">💻</a> <a href="#projectManagement-kyranet" title="Project Management">📆</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Akyranet" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/sapphiredev/utilities/commits?author=kyranet" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/PyroTechniac"><img src="https://avatars2.githubusercontent.com/u/39341355?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Gryffon Bellish</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Code">💻</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3APyroTechniac" title="Reviewed Pull Requests">👀</a> <a href="https://github.com/sapphiredev/utilities/commits?author=PyroTechniac" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/vladfrangu"><img src="https://avatars3.githubusercontent.com/u/17960496?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Frangu</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Code">💻</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3Avladfrangu" title="Bug reports">🐛</a> <a href="https://github.com/sapphiredev/utilities/pulls?q=is%3Apr+reviewed-by%3Avladfrangu" title="Reviewed Pull Requests">👀</a> <a href="#userTesting-vladfrangu" title="User Testing">📓</a> <a href="https://github.com/sapphiredev/utilities/commits?author=vladfrangu" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/Stitch07"><img src="https://avatars0.githubusercontent.com/u/29275227?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Stitch07</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Code">💻</a> <a href="#projectManagement-Stitch07" title="Project Management">📆</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Stitch07" title="Tests">⚠️</a></td>
|
||||
<td align="center"><a href="https://github.com/apps/depfu"><img src="https://avatars3.githubusercontent.com/in/715?v=4?s=100" width="100px;" alt=""/><br /><sub><b>depfu[bot]</b></sub></a><br /><a href="#maintenance-depfu[bot]" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://github.com/apps/allcontributors"><img src="https://avatars0.githubusercontent.com/in/23186?v=4?s=100" width="100px;" alt=""/><br /><sub><b>allcontributors[bot]</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=allcontributors[bot]" title="Documentation">📖</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/Nytelife26"><img src="https://avatars1.githubusercontent.com/u/22531310?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Tyler J Russell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Nytelife26" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/Alcremie"><img src="https://avatars0.githubusercontent.com/u/54785334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ivan Lieder</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Alcremie" title="Code">💻</a> <a href="https://github.com/sapphiredev/utilities/issues?q=author%3AAlcremie" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://github.com/RealShadowNova"><img src="https://avatars3.githubusercontent.com/u/46537907?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Hezekiah Hendry</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=RealShadowNova" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/Vetlix"><img src="https://avatars.githubusercontent.com/u/31412314?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vetlix</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Vetlix" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/ethamitc"><img src="https://avatars.githubusercontent.com/u/27776796?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ethan Mitchell</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ethamitc" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/noftaly"><img src="https://avatars.githubusercontent.com/u/34779161?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Elliot</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=noftaly" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://jurien.dev"><img src="https://avatars.githubusercontent.com/u/5418114?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jurien Hamaker</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=jurienhamaker" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://fanoulis.dev/"><img src="https://avatars.githubusercontent.com/u/38255093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Charalampos Fanoulis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=cfanoulis" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://github.com/apps/dependabot"><img src="https://avatars.githubusercontent.com/in/29110?v=4?s=100" width="100px;" alt=""/><br /><sub><b>dependabot[bot]</b></sub></a><br /><a href="#maintenance-dependabot[bot]" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://kaname.netlify.app/"><img src="https://avatars.githubusercontent.com/u/56084970?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kaname</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=kaname-png" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/nandhagk"><img src="https://avatars.githubusercontent.com/u/62976649?v=4?s=100" width="100px;" alt=""/><br /><sub><b>nandhagk</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/issues?q=author%3Anandhagk" title="Bug reports">🐛</a></td>
|
||||
<td align="center"><a href="https://megatank58.me/"><img src="https://avatars.githubusercontent.com/u/51410502?v=4?s=100" width="100px;" alt=""/><br /><sub><b>megatank58</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=megatank58" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/UndiedGamer"><img src="https://avatars.githubusercontent.com/u/84702365?v=4?s=100" width="100px;" alt=""/><br /><sub><b>UndiedGamer</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=UndiedGamer" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/Lioness100"><img src="https://avatars.githubusercontent.com/u/65814829?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Lioness100</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Documentation">📖</a> <a href="https://github.com/sapphiredev/utilities/commits?author=Lioness100" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://gitlab.com/DavidPH/"><img src="https://avatars.githubusercontent.com/u/44669930?v=4?s=100" width="100px;" alt=""/><br /><sub><b>David</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=DavidPHH" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/apps/renovate"><img src="https://avatars.githubusercontent.com/in/2740?v=4?s=100" width="100px;" alt=""/><br /><sub><b>renovate[bot]</b></sub></a><br /><a href="#maintenance-renovate[bot]" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://renovate.whitesourcesoftware.com/"><img src="https://avatars.githubusercontent.com/u/25180681?v=4?s=100" width="100px;" alt=""/><br /><sub><b>WhiteSource Renovate</b></sub></a><br /><a href="#maintenance-renovate-bot" title="Maintenance">🚧</a></td>
|
||||
<td align="center"><a href="https://fc5570.me/"><img src="https://avatars.githubusercontent.com/u/68158483?v=4?s=100" width="100px;" alt=""/><br /><sub><b>FC</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=FC5570" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/Tokipudi"><img src="https://avatars.githubusercontent.com/u/29551076?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jérémy de Saint Denis</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=Tokipudi" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/ItsMrCube"><img src="https://avatars.githubusercontent.com/u/25201357?v=4?s=100" width="100px;" alt=""/><br /><sub><b>MrCube</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=ItsMrCube" title="Code">💻</a></td>
|
||||
<td align="center"><a href="https://github.com/bitomic"><img src="https://avatars.githubusercontent.com/u/35199700?v=4?s=100" width="100px;" alt=""/><br /><sub><b>bitomic</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=bitomic" title="Code">💻</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://c43721.dev/"><img src="https://avatars.githubusercontent.com/u/55610086?v=4?s=100" width="100px;" alt=""/><br /><sub><b>c43721</b></sub></a><br /><a href="https://github.com/sapphiredev/utilities/commits?author=c43721" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- markdownlint-restore -->
|
||||
<!-- prettier-ignore-end -->
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
||||
|
||||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
|
||||
2
node_modules/@sapphire/async-queue/dist/index.d.ts
generated
vendored
Normal file
2
node_modules/@sapphire/async-queue/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './lib/AsyncQueue';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
60
node_modules/@sapphire/async-queue/dist/index.global.js
generated
vendored
Normal file
60
node_modules/@sapphire/async-queue/dist/index.global.js
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
var SapphireAsyncQueue = (() => {
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
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);
|
||||
var __publicField = (obj, key, value) => {
|
||||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
AsyncQueue: () => AsyncQueue
|
||||
});
|
||||
|
||||
// src/lib/AsyncQueue.ts
|
||||
var AsyncQueue = class {
|
||||
constructor() {
|
||||
__publicField(this, "promises", []);
|
||||
}
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
wait() {
|
||||
const next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();
|
||||
let resolve;
|
||||
const promise = new Promise((res) => {
|
||||
resolve = res;
|
||||
});
|
||||
this.promises.push({
|
||||
resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
shift() {
|
||||
const deferred = this.promises.shift();
|
||||
if (typeof deferred !== "undefined")
|
||||
deferred.resolve();
|
||||
}
|
||||
};
|
||||
return __toCommonJS(src_exports);
|
||||
})();
|
||||
//# sourceMappingURL=index.global.js.map
|
||||
1
node_modules/@sapphire/async-queue/dist/index.global.js.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/index.global.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.ts","../src/lib/AsyncQueue.ts"],"sourcesContent":["export * from './lib/AsyncQueue';\n","/**\n * The AsyncQueue class used to sequentialize burst requests\n */\nexport class AsyncQueue {\n\t/**\n\t * The remaining amount of queued promises\n\t */\n\tpublic get remaining(): number {\n\t\treturn this.promises.length;\n\t}\n\n\t/**\n\t * The promises array\n\t */\n\tprivate promises: InternalAsyncQueueDeferredPromise[] = [];\n\n\t/**\n\t * Waits for last promise and queues a new one\n\t * @example\n\t * ```typescript\n\t * const queue = new AsyncQueue();\n\t * async function request(url, options) {\n\t * await queue.wait();\n\t * try {\n\t * const result = await fetch(url, options);\n\t * // Do some operations with 'result'\n\t * } finally {\n\t * // Remove first entry from the queue and resolve for the next entry\n\t * queue.shift();\n\t * }\n\t * }\n\t *\n\t * request(someUrl1, someOptions1); // Will call fetch() immediately\n\t * request(someUrl2, someOptions2); // Will call fetch() after the first finished\n\t * request(someUrl3, someOptions3); // Will call fetch() after the second finished\n\t * ```\n\t */\n\tpublic wait(): Promise<void> {\n\t\tconst next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();\n\t\tlet resolve: () => void;\n\t\tconst promise = new Promise<void>((res) => {\n\t\t\tresolve = res;\n\t\t});\n\n\t\tthis.promises.push({\n\t\t\tresolve: resolve!,\n\t\t\tpromise\n\t\t});\n\n\t\treturn next;\n\t}\n\n\t/**\n\t * Frees the queue's lock for the next item to process\n\t */\n\tpublic shift(): void {\n\t\tconst deferred = this.promises.shift();\n\t\tif (typeof deferred !== 'undefined') deferred.resolve();\n\t}\n}\n\n/**\n * @internal\n */\ninterface InternalAsyncQueueDeferredPromise {\n\tresolve(): void;\n\tpromise: Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;;;ACGO,yBAAiB;AAAA,IAAjB;AAWE,sCAAgD,CAAC;AAAA;AAAA,QAP9C,YAAoB;AAC9B,aAAO,KAAK,SAAS;AAAA,IACtB;AAAA,IA4BO,OAAsB;AAC5B,YAAM,OAAO,KAAK,SAAS,SAAS,KAAK,SAAS,KAAK,SAAS,SAAS,GAAG,UAAU,QAAQ,QAAQ;AACtG,UAAI;AACJ,YAAM,UAAU,IAAI,QAAc,CAAC,QAAQ;AAC1C,kBAAU;AAAA,MACX,CAAC;AAED,WAAK,SAAS,KAAK;AAAA,QAClB;AAAA,QACA;AAAA,MACD,CAAC;AAED,aAAO;AAAA,IACR;AAAA,IAKO,QAAc;AACpB,YAAM,WAAW,KAAK,SAAS,MAAM;AACrC,UAAI,OAAO,aAAa;AAAa,iBAAS,QAAQ;AAAA,IACvD;AAAA,EACD;AAxDO","names":[]}
|
||||
63
node_modules/@sapphire/async-queue/dist/index.js
generated
vendored
Normal file
63
node_modules/@sapphire/async-queue/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
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);
|
||||
var __publicField = (obj, key, value) => {
|
||||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
AsyncQueue: () => AsyncQueue
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/lib/AsyncQueue.ts
|
||||
var AsyncQueue = class {
|
||||
constructor() {
|
||||
__publicField(this, "promises", []);
|
||||
}
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
wait() {
|
||||
const next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();
|
||||
let resolve;
|
||||
const promise = new Promise((res) => {
|
||||
resolve = res;
|
||||
});
|
||||
this.promises.push({
|
||||
resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
shift() {
|
||||
const deferred = this.promises.shift();
|
||||
if (typeof deferred !== "undefined")
|
||||
deferred.resolve();
|
||||
}
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
AsyncQueue
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@sapphire/async-queue/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.ts","../src/lib/AsyncQueue.ts"],"sourcesContent":["export * from './lib/AsyncQueue';\n","/**\n * The AsyncQueue class used to sequentialize burst requests\n */\nexport class AsyncQueue {\n\t/**\n\t * The remaining amount of queued promises\n\t */\n\tpublic get remaining(): number {\n\t\treturn this.promises.length;\n\t}\n\n\t/**\n\t * The promises array\n\t */\n\tprivate promises: InternalAsyncQueueDeferredPromise[] = [];\n\n\t/**\n\t * Waits for last promise and queues a new one\n\t * @example\n\t * ```typescript\n\t * const queue = new AsyncQueue();\n\t * async function request(url, options) {\n\t * await queue.wait();\n\t * try {\n\t * const result = await fetch(url, options);\n\t * // Do some operations with 'result'\n\t * } finally {\n\t * // Remove first entry from the queue and resolve for the next entry\n\t * queue.shift();\n\t * }\n\t * }\n\t *\n\t * request(someUrl1, someOptions1); // Will call fetch() immediately\n\t * request(someUrl2, someOptions2); // Will call fetch() after the first finished\n\t * request(someUrl3, someOptions3); // Will call fetch() after the second finished\n\t * ```\n\t */\n\tpublic wait(): Promise<void> {\n\t\tconst next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();\n\t\tlet resolve: () => void;\n\t\tconst promise = new Promise<void>((res) => {\n\t\t\tresolve = res;\n\t\t});\n\n\t\tthis.promises.push({\n\t\t\tresolve: resolve!,\n\t\t\tpromise\n\t\t});\n\n\t\treturn next;\n\t}\n\n\t/**\n\t * Frees the queue's lock for the next item to process\n\t */\n\tpublic shift(): void {\n\t\tconst deferred = this.promises.shift();\n\t\tif (typeof deferred !== 'undefined') deferred.resolve();\n\t}\n}\n\n/**\n * @internal\n */\ninterface InternalAsyncQueueDeferredPromise {\n\tresolve(): void;\n\tpromise: Promise<void>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGO,uBAAiB;AAAA,EAAjB;AAWE,oCAAgD,CAAC;AAAA;AAAA,MAP9C,YAAoB;AAC9B,WAAO,KAAK,SAAS;AAAA,EACtB;AAAA,EA4BO,OAAsB;AAC5B,UAAM,OAAO,KAAK,SAAS,SAAS,KAAK,SAAS,KAAK,SAAS,SAAS,GAAG,UAAU,QAAQ,QAAQ;AACtG,QAAI;AACJ,UAAM,UAAU,IAAI,QAAc,CAAC,QAAQ;AAC1C,gBAAU;AAAA,IACX,CAAC;AAED,SAAK,SAAS,KAAK;AAAA,MAClB;AAAA,MACA;AAAA,IACD,CAAC;AAED,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,UAAM,WAAW,KAAK,SAAS,MAAM;AACrC,QAAI,OAAO,aAAa;AAAa,eAAS,QAAQ;AAAA,EACvD;AACD;AAxDO","names":[]}
|
||||
38
node_modules/@sapphire/async-queue/dist/index.mjs
generated
vendored
Normal file
38
node_modules/@sapphire/async-queue/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
var __defProp = Object.defineProperty;
|
||||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
||||
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
||||
var __publicField = (obj, key, value) => {
|
||||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
||||
return value;
|
||||
};
|
||||
|
||||
// src/lib/AsyncQueue.ts
|
||||
var AsyncQueue = class {
|
||||
constructor() {
|
||||
__publicField(this, "promises", []);
|
||||
}
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
wait() {
|
||||
const next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();
|
||||
let resolve;
|
||||
const promise = new Promise((res) => {
|
||||
resolve = res;
|
||||
});
|
||||
this.promises.push({
|
||||
resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
shift() {
|
||||
const deferred = this.promises.shift();
|
||||
if (typeof deferred !== "undefined")
|
||||
deferred.resolve();
|
||||
}
|
||||
};
|
||||
export {
|
||||
AsyncQueue
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
1
node_modules/@sapphire/async-queue/dist/index.mjs.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/index.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/lib/AsyncQueue.ts"],"sourcesContent":["/**\n * The AsyncQueue class used to sequentialize burst requests\n */\nexport class AsyncQueue {\n\t/**\n\t * The remaining amount of queued promises\n\t */\n\tpublic get remaining(): number {\n\t\treturn this.promises.length;\n\t}\n\n\t/**\n\t * The promises array\n\t */\n\tprivate promises: InternalAsyncQueueDeferredPromise[] = [];\n\n\t/**\n\t * Waits for last promise and queues a new one\n\t * @example\n\t * ```typescript\n\t * const queue = new AsyncQueue();\n\t * async function request(url, options) {\n\t * await queue.wait();\n\t * try {\n\t * const result = await fetch(url, options);\n\t * // Do some operations with 'result'\n\t * } finally {\n\t * // Remove first entry from the queue and resolve for the next entry\n\t * queue.shift();\n\t * }\n\t * }\n\t *\n\t * request(someUrl1, someOptions1); // Will call fetch() immediately\n\t * request(someUrl2, someOptions2); // Will call fetch() after the first finished\n\t * request(someUrl3, someOptions3); // Will call fetch() after the second finished\n\t * ```\n\t */\n\tpublic wait(): Promise<void> {\n\t\tconst next = this.promises.length ? this.promises[this.promises.length - 1].promise : Promise.resolve();\n\t\tlet resolve: () => void;\n\t\tconst promise = new Promise<void>((res) => {\n\t\t\tresolve = res;\n\t\t});\n\n\t\tthis.promises.push({\n\t\t\tresolve: resolve!,\n\t\t\tpromise\n\t\t});\n\n\t\treturn next;\n\t}\n\n\t/**\n\t * Frees the queue's lock for the next item to process\n\t */\n\tpublic shift(): void {\n\t\tconst deferred = this.promises.shift();\n\t\tif (typeof deferred !== 'undefined') deferred.resolve();\n\t}\n}\n\n/**\n * @internal\n */\ninterface InternalAsyncQueueDeferredPromise {\n\tresolve(): void;\n\tpromise: Promise<void>;\n}\n"],"mappings":";;;;;;;;;AAGO,uBAAiB;AAAA,EAAjB;AAWE,oCAAgD,CAAC;AAAA;AAAA,MAP9C,YAAoB;AAC9B,WAAO,KAAK,SAAS;AAAA,EACtB;AAAA,EA4BO,OAAsB;AAC5B,UAAM,OAAO,KAAK,SAAS,SAAS,KAAK,SAAS,KAAK,SAAS,SAAS,GAAG,UAAU,QAAQ,QAAQ;AACtG,QAAI;AACJ,UAAM,UAAU,IAAI,QAAc,CAAC,QAAQ;AAC1C,gBAAU;AAAA,IACX,CAAC;AAED,SAAK,SAAS,KAAK;AAAA,MAClB;AAAA,MACA;AAAA,IACD,CAAC;AAED,WAAO;AAAA,EACR;AAAA,EAKO,QAAc;AACpB,UAAM,WAAW,KAAK,SAAS,MAAM;AACrC,QAAI,OAAO,aAAa;AAAa,eAAS,QAAQ;AAAA,EACvD;AACD;AAxDO","names":[]}
|
||||
40
node_modules/@sapphire/async-queue/dist/lib/AsyncQueue.d.ts
generated
vendored
Normal file
40
node_modules/@sapphire/async-queue/dist/lib/AsyncQueue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* The AsyncQueue class used to sequentialize burst requests
|
||||
*/
|
||||
export declare class AsyncQueue {
|
||||
/**
|
||||
* The remaining amount of queued promises
|
||||
*/
|
||||
get remaining(): number;
|
||||
/**
|
||||
* The promises array
|
||||
*/
|
||||
private promises;
|
||||
/**
|
||||
* Waits for last promise and queues a new one
|
||||
* @example
|
||||
* ```typescript
|
||||
* const queue = new AsyncQueue();
|
||||
* async function request(url, options) {
|
||||
* await queue.wait();
|
||||
* try {
|
||||
* const result = await fetch(url, options);
|
||||
* // Do some operations with 'result'
|
||||
* } finally {
|
||||
* // Remove first entry from the queue and resolve for the next entry
|
||||
* queue.shift();
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* request(someUrl1, someOptions1); // Will call fetch() immediately
|
||||
* request(someUrl2, someOptions2); // Will call fetch() after the first finished
|
||||
* request(someUrl3, someOptions3); // Will call fetch() after the second finished
|
||||
* ```
|
||||
*/
|
||||
wait(): Promise<void>;
|
||||
/**
|
||||
* Frees the queue's lock for the next item to process
|
||||
*/
|
||||
shift(): void;
|
||||
}
|
||||
//# sourceMappingURL=AsyncQueue.d.ts.map
|
||||
56
node_modules/@sapphire/async-queue/package.json
generated
vendored
Normal file
56
node_modules/@sapphire/async-queue/package.json
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"name": "@sapphire/async-queue",
|
||||
"version": "1.3.1",
|
||||
"description": "Sequential asynchronous lock-based queue for promises",
|
||||
"author": "@sapphire",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"browser": "dist/index.global.js",
|
||||
"unpkg": "dist/index.global.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"typedocMain": "src/index.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"homepage": "https://github.com/sapphiredev/utilities/tree/main/packages/async-queue",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"lint": "eslint src tests --ext ts --fix -c ../../.eslintrc",
|
||||
"build": "tsup && tsc -b src",
|
||||
"prepublishOnly": "yarn build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sapphiredev/utilities.git",
|
||||
"directory": "packages/async-queue"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"!dist/*.tsbuildinfo"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=v14.0.0",
|
||||
"npm": ">=7.0.0"
|
||||
},
|
||||
"keywords": [
|
||||
"@sapphire/async-queue",
|
||||
"bot",
|
||||
"typescript",
|
||||
"ts",
|
||||
"yarn",
|
||||
"discord",
|
||||
"sapphire",
|
||||
"standalone"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/sapphiredev/utilities/issues"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "bf5ac56e547bfdbfac38e020882004e0f136546e"
|
||||
}
|
||||
Reference in New Issue
Block a user