From e06ec920f7a5d784e674c4c4b4e6d1da3dc7391d Mon Sep 17 00:00:00 2001 From: Piotr Russ Date: Mon, 16 Nov 2020 00:10:28 +0100 Subject: api, login, auth --- node_modules/minipass-flush/LICENSE | 15 +++++++ node_modules/minipass-flush/README.md | 47 +++++++++++++++++++++ node_modules/minipass-flush/index.js | 39 +++++++++++++++++ node_modules/minipass-flush/package.json | 72 ++++++++++++++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 node_modules/minipass-flush/LICENSE create mode 100644 node_modules/minipass-flush/README.md create mode 100644 node_modules/minipass-flush/index.js create mode 100644 node_modules/minipass-flush/package.json (limited to 'node_modules/minipass-flush') diff --git a/node_modules/minipass-flush/LICENSE b/node_modules/minipass-flush/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/node_modules/minipass-flush/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/minipass-flush/README.md b/node_modules/minipass-flush/README.md new file mode 100644 index 0000000..7eea400 --- /dev/null +++ b/node_modules/minipass-flush/README.md @@ -0,0 +1,47 @@ +# minipass-flush + +A Minipass stream that calls a flush function before emitting 'end' + +## USAGE + +```js +const Flush = require('minipass-flush') +cons f = new Flush({ + flush (cb) { + // call the cb when done, or return a promise + // the 'end' event will wait for it, along with + // close, finish, and prefinish. + // call the cb with an error, or return a rejecting + // promise to emit 'error' instead of doing the 'end' + return rerouteAllEncryptions().then(() => clearAllChannels()) + }, + // all other minipass options accepted as well +}) + +someDataSource.pipe(f).on('end', () => { + // proper flushing has been accomplished +}) + +// Or as a subclass implementing a 'flush' method: +class MyFlush extends Flush { + flush (cb) { + // old fashioned callback style! + rerouteAllEncryptions(er => { + if (er) + return cb(er) + clearAllChannels(er => { + if (er) + cb(er) + cb() + }) + }) + } +} +``` + +That's about it. + +If your `flush` method doesn't have to do anything asynchronous, then it's +better to call the callback right away in this tick, rather than returning +`Promise.resolve()`, so that the `end` event can happen as soon as +possible. diff --git a/node_modules/minipass-flush/index.js b/node_modules/minipass-flush/index.js new file mode 100644 index 0000000..cb2537f --- /dev/null +++ b/node_modules/minipass-flush/index.js @@ -0,0 +1,39 @@ +const Minipass = require('minipass') +const _flush = Symbol('_flush') +const _flushed = Symbol('_flushed') +const _flushing = Symbol('_flushing') +class Flush extends Minipass { + constructor (opt = {}) { + if (typeof opt === 'function') + opt = { flush: opt } + + super(opt) + + // or extend this class and provide a 'flush' method in your subclass + if (typeof opt.flush !== 'function' && typeof this.flush !== 'function') + throw new TypeError('must provide flush function in options') + + this[_flush] = opt.flush || this.flush + } + + emit (ev, ...data) { + if ((ev !== 'end' && ev !== 'finish') || this[_flushed]) + return super.emit(ev, ...data) + + if (this[_flushing]) + return + + this[_flushing] = true + + const afterFlush = er => { + this[_flushed] = true + er ? super.emit('error', er) : super.emit('end') + } + + const ret = this[_flush](afterFlush) + if (ret && ret.then) + ret.then(() => afterFlush(), er => afterFlush(er)) + } +} + +module.exports = Flush diff --git a/node_modules/minipass-flush/package.json b/node_modules/minipass-flush/package.json new file mode 100644 index 0000000..5363340 --- /dev/null +++ b/node_modules/minipass-flush/package.json @@ -0,0 +1,72 @@ +{ + "_from": "minipass-flush@^1.0.5", + "_id": "minipass-flush@1.0.5", + "_inBundle": false, + "_integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==", + "_location": "/minipass-flush", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "minipass-flush@^1.0.5", + "name": "minipass-flush", + "escapedName": "minipass-flush", + "rawSpec": "^1.0.5", + "saveSpec": null, + "fetchSpec": "^1.0.5" + }, + "_requiredBy": [ + "/cacache" + ], + "_resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", + "_shasum": "82e7135d7e89a50ffe64610a787953c4c4cbb373", + "_spec": "minipass-flush@^1.0.5", + "_where": "/home/pruss/Dev/3-minute-website/node_modules/cacache", + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "https://izs.me" + }, + "bugs": { + "url": "https://github.com/isaacs/minipass-flush/issues" + }, + "bundleDependencies": false, + "dependencies": { + "minipass": "^3.0.0" + }, + "deprecated": false, + "description": "A Minipass stream that calls a flush function before emitting 'end'", + "devDependencies": { + "tap": "^14.6.9" + }, + "engines": { + "node": ">= 8" + }, + "files": [ + "index.js" + ], + "homepage": "https://github.com/isaacs/minipass-flush#readme", + "keywords": [ + "minipass", + "flush", + "stream" + ], + "license": "ISC", + "main": "index.js", + "name": "minipass-flush", + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/minipass-flush.git" + }, + "scripts": { + "postpublish": "git push origin --follow-tags", + "postversion": "npm publish", + "preversion": "npm test", + "snap": "tap", + "test": "tap" + }, + "tap": { + "check-coverage": true + }, + "version": "1.0.5" +} -- cgit v1.2.3