your mums gay
This commit is contained in:
commit
618c069385
1195 changed files with 147582 additions and 0 deletions
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.
|
92
node_modules/@sapphire/async-queue/README.md
generated
vendored
Normal file
92
node_modules/@sapphire/async-queue/README.md
generated
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
<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 Rollup 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></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
|
1
node_modules/@sapphire/async-queue/dist/index.d.ts.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
|
70
node_modules/@sapphire/async-queue/dist/index.js
generated
vendored
Normal file
70
node_modules/@sapphire/async-queue/dist/index.js
generated
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
/**
|
||||
* The AsyncQueue class used to sequentialize burst requests
|
||||
*/
|
||||
class AsyncQueue {
|
||||
constructor() {
|
||||
/**
|
||||
* The promises array
|
||||
*/
|
||||
Object.defineProperty(this, "promises", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The remaining amount of queued promises
|
||||
*/
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
/**
|
||||
* 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() {
|
||||
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: resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
/**
|
||||
* Frees the queue's lock for the next item to process
|
||||
*/
|
||||
shift() {
|
||||
const deferred = this.promises.shift();
|
||||
if (typeof deferred !== 'undefined')
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
exports.AsyncQueue = 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,"file":"index.js","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"],"names":[],"mappings":";;;;AAAA;;;MAGa,UAAU;IAAvB;;;;QAWC;;;;mBAAwD,EAAE;WAAC;KA6C3D;;;;IApDA,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;KAC5B;;;;;;;;;;;;;;;;;;;;;;IA4BM,IAAI;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QACxG,IAAI,OAAmB,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,GAAG;YACrC,OAAO,GAAG,GAAG,CAAC;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,OAAQ;YACjB,OAAO;SACP,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;KACZ;;;;IAKM,KAAK;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;KACxD;;;;;"}
|
66
node_modules/@sapphire/async-queue/dist/index.mjs
generated
vendored
Normal file
66
node_modules/@sapphire/async-queue/dist/index.mjs
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* The AsyncQueue class used to sequentialize burst requests
|
||||
*/
|
||||
class AsyncQueue {
|
||||
constructor() {
|
||||
/**
|
||||
* The promises array
|
||||
*/
|
||||
Object.defineProperty(this, "promises", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The remaining amount of queued promises
|
||||
*/
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
/**
|
||||
* 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() {
|
||||
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: resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
/**
|
||||
* Frees the queue's lock for the next item to process
|
||||
*/
|
||||
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,"file":"index.mjs","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"],"names":[],"mappings":"AAAA;;;MAGa,UAAU;IAAvB;;;;QAWC;;;;mBAAwD,EAAE;WAAC;KA6C3D;;;;IApDA,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;KAC5B;;;;;;;;;;;;;;;;;;;;;;IA4BM,IAAI;QACV,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;QACxG,IAAI,OAAmB,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,GAAG;YACrC,OAAO,GAAG,GAAG,CAAC;SACd,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAClB,OAAO,EAAE,OAAQ;YACjB,OAAO;SACP,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;KACZ;;;;IAKM,KAAK;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;KACxD;;;;;"}
|
76
node_modules/@sapphire/async-queue/dist/index.umd.js
generated
vendored
Normal file
76
node_modules/@sapphire/async-queue/dist/index.umd.js
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.SapphireAsyncQueue = {}));
|
||||
})(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* The AsyncQueue class used to sequentialize burst requests
|
||||
*/
|
||||
class AsyncQueue {
|
||||
constructor() {
|
||||
/**
|
||||
* The promises array
|
||||
*/
|
||||
Object.defineProperty(this, "promises", {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true,
|
||||
value: []
|
||||
});
|
||||
}
|
||||
/**
|
||||
* The remaining amount of queued promises
|
||||
*/
|
||||
get remaining() {
|
||||
return this.promises.length;
|
||||
}
|
||||
/**
|
||||
* 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() {
|
||||
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: resolve,
|
||||
promise
|
||||
});
|
||||
return next;
|
||||
}
|
||||
/**
|
||||
* Frees the queue's lock for the next item to process
|
||||
*/
|
||||
shift() {
|
||||
const deferred = this.promises.shift();
|
||||
if (typeof deferred !== 'undefined')
|
||||
deferred.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
exports.AsyncQueue = AsyncQueue;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
}));
|
||||
//# sourceMappingURL=index.umd.js.map
|
1
node_modules/@sapphire/async-queue/dist/index.umd.js.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/index.umd.js.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.umd.js","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"],"names":[],"mappings":";;;;;;CAAA;;;OAGa,UAAU;KAAvB;;;;SAWC;;;;oBAAwD,EAAE;YAAC;MA6C3D;;;;KApDA,IAAW,SAAS;SACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;MAC5B;;;;;;;;;;;;;;;;;;;;;;KA4BM,IAAI;SACV,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;SACxG,IAAI,OAAmB,CAAC;SACxB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,GAAG;aACrC,OAAO,GAAG,GAAG,CAAC;UACd,CAAC,CAAC;SAEH,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;aAClB,OAAO,EAAE,OAAQ;aACjB,OAAO;UACP,CAAC,CAAC;SAEH,OAAO,IAAI,CAAC;MACZ;;;;KAKM,KAAK;SACX,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;SACvC,IAAI,OAAO,QAAQ,KAAK,WAAW;aAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;MACxD;;;;;;;;;;;"}
|
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
|
1
node_modules/@sapphire/async-queue/dist/lib/AsyncQueue.d.ts.map
generated
vendored
Normal file
1
node_modules/@sapphire/async-queue/dist/lib/AsyncQueue.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"AsyncQueue.d.ts","sourceRoot":"","sources":["../../src/lib/AsyncQueue.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAU;IACtB;;OAEG;IACH,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED;;OAEG;IACH,OAAO,CAAC,QAAQ,CAA2C;IAE3D;;;;;;;;;;;;;;;;;;;;OAoBG;IACI,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAe5B;;OAEG;IACI,KAAK,IAAI,IAAI;CAIpB"}
|
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.1.9",
|
||||
"description": "Sequential asynchronous lock-based queue for promises",
|
||||
"author": "@sapphire",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.mjs",
|
||||
"browser": "dist/index.umd.js",
|
||||
"unpkg": "dist/index.umd.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"typedocMain": "src/index.ts",
|
||||
"exports": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.js"
|
||||
},
|
||||
"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": "rollup -c",
|
||||
"start": "yarn build -w",
|
||||
"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": "4889ea35a0b081021981ff3d73e5005dd1e922ce"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue