node_modules ignore

This commit is contained in:
2025-05-08 23:43:47 +02:00
parent e19d52f172
commit 4574544c9f
65041 changed files with 10593536 additions and 0 deletions

94
server/node_modules/stream-chain/utils/FromIterable.js generated vendored Normal file
View File

@@ -0,0 +1,94 @@
'use strict';
const {Readable} = require('stream');
class FromIterable extends Readable {
constructor(options) {
super(Object.assign({}, options, {objectMode: true}));
this._iterable = null;
this._next = null;
if (options) {
'iterable' in options && (this._iterable = options.iterable);
}
!this._iterable && (this._read = this._readStop);
}
_read() {
if (Symbol.asyncIterator && typeof this._iterable[Symbol.asyncIterator] == 'function') {
this._next = this._iterable[Symbol.asyncIterator]();
this._iterable = null;
this._read = this._readNext;
this._readNext();
return;
}
if (Symbol.iterator && typeof this._iterable[Symbol.iterator] == 'function') {
this._next = this._iterable[Symbol.iterator]();
this._iterable = null;
this._read = this._readNext;
this._readNext();
return;
}
if (typeof this._iterable.next == 'function') {
this._next = this._iterable;
this._iterable = null;
this._read = this._readNext;
this._readNext();
return;
}
const result = this._iterable();
this._iterable = null;
if (result && typeof result.then == 'function') {
result.then(value => this.push(value), error => this.emit('error', error));
this._read = this._readStop;
return;
}
if (result && typeof result.next == 'function') {
this._next = result;
this._read = this._readNext;
this._readNext();
return;
}
this.push(result);
this._read = this._readStop;
}
_readNext() {
for (;;) {
const result = this._next.next();
if (result && typeof result.then == 'function') {
result.then(
value => {
if (value.done || value.value === null) {
this.push(null);
this._next = null;
this._read = this._readStop;
} else {
this.push(value.value);
}
},
error => this.emit('error', error)
);
break;
}
if (result.done || result.value === null) {
this.push(null);
this._next = null;
this._read = this._readStop;
break;
}
if (!this.push(result.value)) break;
}
}
_readStop() {
this.push(null);
}
static make(iterable) {
return new FromIterable(typeof iterable == 'object' && iterable.iterable ? iterable : {iterable});
}
}
FromIterable.fromIterable = FromIterable.make;
FromIterable.make.Constructor = FromIterable;
module.exports = FromIterable;

40
server/node_modules/stream-chain/utils/Reduce.js generated vendored Normal file
View File

@@ -0,0 +1,40 @@
'use strict';
const {Writable} = require('stream');
const defaultInitial = 0;
const defaultReducer = (acc, value) => value;
class Reduce extends Writable {
constructor(options) {
super(Object.assign({}, options, {objectMode: true}));
this.accumulator = defaultInitial;
this._reducer = defaultReducer;
if (options) {
'initial' in options && (this.accumulator = options.initial);
'reducer' in options && (this._reducer = options.reducer);
}
}
_write(chunk, encoding, callback) {
const result = this._reducer.call(this, this.accumulator, chunk);
if (result && typeof result.then == 'function') {
result.then(
value => {
this.accumulator = value;
callback(null);
},
error => callback(error)
);
} else {
this.accumulator = result;
callback(null);
}
}
static make(reducer, initial) {
return new Reduce(typeof reducer == 'object' ? reducer : {reducer, initial});
}
}
Reduce.reduce = Reduce.make;
Reduce.make.Constructor = Reduce;
module.exports = Reduce;

85
server/node_modules/stream-chain/utils/asFun.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
'use strict';
const {none, final, isFinal, getFinalValue, many, isMany, getManyValues} = require('../defs');
const next = async (value, fns, index, push) => {
for (let i = index; i <= fns.length; ++i) {
if (value && typeof value.then == 'function') {
// thenable
value = await value;
}
if (value === none) break;
if (isFinal(value)) {
const val = getFinalValue(value);
val !== none && push(val);
break;
}
if (isMany(value)) {
const values = getManyValues(value);
if (i == fns.length) {
values.forEach(val => push(val));
} else {
for (let j = 0; j < values.length; ++j) {
await next(values[j], fns, i, push);
}
}
break;
}
if (value && typeof value.next == 'function') {
// generator
for (;;) {
let data = value.next();
if (data && typeof data.then == 'function') {
data = await data;
}
if (data.done) break;
if (i == fns.length) {
push(data.value);
} else {
await next(data.value, fns, i, push);
}
}
break;
}
if (i == fns.length) {
push(value);
break;
}
value = fns[i](value);
}
};
const nop = () => {};
const asFun = (...fns) => {
fns = fns.filter(fn => fn);
if (!fns.length) return nop;
if (Symbol.asyncIterator && fns[0][Symbol.asyncIterator]) {
fns[0] = fns[0][Symbol.asyncIterator];
} else if (Symbol.iterator && fns[0][Symbol.iterator]) {
fns[0] = fns[0][Symbol.iterator];
}
return async value => {
const results = [];
await next(value, fns, 0, value => results.push(value));
switch (results.length) {
case 0:
return none;
case 1:
return results[0];
}
return many(results);
};
};
asFun.next = next;
asFun.none = none;
asFun.final = final;
asFun.isFinal = isFinal;
asFun.getFinalValue = getFinalValue;
asFun.many = many;
asFun.isMany = isMany;
asFun.getManyValues = getManyValues;
module.exports = asFun;

77
server/node_modules/stream-chain/utils/asGen.js generated vendored Normal file
View File

@@ -0,0 +1,77 @@
'use strict';
const {none, final, isFinal, getFinalValue, many, isMany, getManyValues} = require('../defs');
const next = async function*(value, fns, index) {
for (let i = index; i <= fns.length; ++i) {
if (value && typeof value.then == 'function') {
// thenable
value = await value;
}
if (value === none) break;
if (isFinal(value)) {
const val = getFinalValue(value);
if (val !== none) yield val;
break;
}
if (isMany(value)) {
const values = getManyValues(value);
if (i == fns.length) {
yield* values;
} else {
for (let j = 0; j < values.length; ++j) {
yield* next(values[j], fns, i);
}
}
break;
}
if (value && typeof value.next == 'function') {
// generator
for (;;) {
let data = value.next();
if (data && typeof data.then == 'function') {
data = await data;
}
if (data.done) break;
if (i == fns.length) {
yield data.value;
} else {
yield* next(data.value, fns, i);
}
}
break;
}
if (i == fns.length) {
yield value;
break;
}
value = fns[i](value);
}
};
const nop = async function*() {};
const asGen = (...fns) => {
fns = fns.filter(fn => fn);
if (!fns.length) return nop;
if (Symbol.asyncIterator && fns[0][Symbol.asyncIterator]) {
fns[0] = fns[0][Symbol.asyncIterator];
} else if (Symbol.iterator && fns[0][Symbol.iterator]) {
fns[0] = fns[0][Symbol.iterator];
}
return async function*(value) {
yield* next(value, fns, 0);
};
};
asGen.next = next;
asGen.none = none;
asGen.final = final;
asGen.isFinal = isFinal;
asGen.getFinalValue = getFinalValue;
asGen.many = many;
asGen.isMany = isMany;
asGen.getManyValues = getManyValues;
module.exports = asGen;

20
server/node_modules/stream-chain/utils/comp.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
'use strict';
const {Transform} = require('stream');
const {next} = require('./asFun');
const {sanitize} = require('../index');
const comp = (...fns) => {
fns = fns.filter(fn => fn);
return fns.length
? new Transform({
writableObjectMode: true,
readableObjectMode: true,
transform(chunk, encoding, callback) {
next(chunk, fns, 0, value => sanitize(value, this)).then(() => callback(null), error => callback(error));
}
})
: null;
};
module.exports = comp;

43
server/node_modules/stream-chain/utils/fold.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
'use strict';
const {Transform} = require('stream');
const defaultInitial = 0;
const defaultReducer = (acc, value) => value;
class Fold extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._accumulator = defaultInitial;
this._reducer = defaultReducer;
if (options) {
'initial' in options && (this._accumulator = options.initial);
'reducer' in options && (this._reducer = options.reducer);
}
}
_transform(chunk, encoding, callback) {
const result = this._reducer.call(this, this._accumulator, chunk);
if (result && typeof result.then == 'function') {
result.then(
value => {
this._accumulator = value;
callback(null);
},
error => callback(error)
);
} else {
this._accumulator = result;
callback(null);
}
}
_final(callback) {
this.push(this._accumulator);
callback(null);
}
static make(reducer, initial) {
return new Fold(typeof reducer == 'object' ? reducer : {reducer, initial});
}
}
Fold.make.Constructor = Fold;
module.exports = Fold.make;

24
server/node_modules/stream-chain/utils/gen.js generated vendored Normal file
View File

@@ -0,0 +1,24 @@
'use strict';
const {Transform} = require('stream');
const {next} = require('./asGen');
const {sanitize} = require('../index');
const gen = (...fns) => {
fns = fns.filter(fn => fn);
return fns.length
? new Transform({
writableObjectMode: true,
readableObjectMode: true,
transform(chunk, encoding, callback) {
(async () => {
for await (let value of next(chunk, fns, 0)) {
sanitize(value, this);
}
})().then(() => callback(null), error => callback(error));
}
})
: null;
};
module.exports = gen;

41
server/node_modules/stream-chain/utils/scan.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
'use strict';
const {Transform} = require('stream');
const defaultInitial = 0;
const defaultReducer = (acc, value) => value;
class Scan extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._accumulator = defaultInitial;
this._reducer = defaultReducer;
if (options) {
'initial' in options && (this._accumulator = options.initial);
'reducer' in options && (this._reducer = options.reducer);
}
}
_transform(chunk, encoding, callback) {
const result = this._reducer.call(this, this._accumulator, chunk);
if (result && typeof result.then == 'function') {
result.then(
value => {
this._accumulator = value;
this.push(this._accumulator);
callback(null);
},
error => callback(error)
);
} else {
this._accumulator = result;
this.push(this._accumulator);
callback(null);
}
}
static make(reducer, initial) {
return new Scan(typeof reducer == 'object' ? reducer : {reducer, initial});
}
}
Scan.make.Constructor = Scan;
module.exports = Scan.make;

32
server/node_modules/stream-chain/utils/skip.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
'use strict';
const {Transform} = require('stream');
class Skip extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._n = 0;
if (options) {
'n' in options && (this._n = options.n);
}
if (this._n <= 0) {
this._transform = this._passThrough;
}
}
_transform(chunk, encoding, callback) {
if (--this._n <= 0) {
this._transform = this._passThrough;
}
callback(null);
}
_passThrough(chunk, encoding, callback) {
this.push(chunk);
callback(null);
}
static make(n) {
return new Skip(typeof n == 'object' ? n : {n});
}
}
Skip.make.Constructor = Skip;
module.exports = Skip.make;

46
server/node_modules/stream-chain/utils/skipWhile.js generated vendored Normal file
View File

@@ -0,0 +1,46 @@
'use strict';
const {Transform} = require('stream');
const alwaysFalse = () => false;
class SkipWhile extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._condition = alwaysFalse;
if (options) {
'condition' in options && (this._condition = options.condition);
}
}
_transform(chunk, encoding, callback) {
const result = this._condition.call(this, chunk);
if (result && typeof result.then == 'function') {
result.then(
flag => {
if (!flag) {
this._transform = this._passThrough;
this.push(chunk);
}
callback(null);
},
error => callback(error)
);
} else {
if (!result) {
this._transform = this._passThrough;
this.push(chunk);
}
callback(null);
}
}
_passThrough(chunk, encoding, callback) {
this.push(chunk);
callback(null);
}
static make(condition) {
return new SkipWhile(typeof condition == 'object' ? condition : {condition});
}
}
SkipWhile.make.Constructor = SkipWhile;
module.exports = SkipWhile.make;

39
server/node_modules/stream-chain/utils/take.js generated vendored Normal file
View File

@@ -0,0 +1,39 @@
'use strict';
const {Transform} = require('stream');
class Take extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._n = this._skip = 0;
if (options) {
'n' in options && (this._n = options.n);
'skip' in options && (this._skip = options.skip);
}
if (this._skip <= 0) {
this._transform = this._n > 0 ? this._countValues : this._doNothing;
}
}
_transform(chunk, encoding, callback) {
if (--this._skip <= 0) {
this._transform = this._n > 0 ? this._countValues : this._doNothing;
}
callback(null);
}
_countValues(chunk, encoding, callback) {
if (--this._n <= 0) {
this._transform = this._doNothing;
}
this.push(chunk);
callback(null);
}
_doNothing(chunk, encoding, callback) {
callback(null);
}
static make(n) {
return new Take(typeof n == 'object' ? n : {n});
}
}
Take.make.Constructor = Take;
module.exports = Take.make;

47
server/node_modules/stream-chain/utils/takeWhile.js generated vendored Normal file
View File

@@ -0,0 +1,47 @@
'use strict';
const {Transform} = require('stream');
const alwaysTrue = () => true;
class TakeWhile extends Transform {
constructor(options) {
super(Object.assign({}, options, {writableObjectMode: true, readableObjectMode: true}));
this._condition = alwaysTrue;
if (options) {
'condition' in options && (this._condition = options.condition);
}
}
_transform(chunk, encoding, callback) {
const result = this._condition.call(this, chunk);
if (result && typeof result.then == 'function') {
result.then(
flag => {
if (flag) {
this.push(chunk);
} else {
this._transform = this._doNothing;
}
callback(null);
},
error => callback(error)
);
} else {
if (result) {
this.push(chunk);
} else {
this._transform = this._doNothing;
}
callback(null);
}
}
_doNothing(chunk, encoding, callback) {
callback(null);
}
static make(condition) {
return new TakeWhile(typeof condition == 'object' ? condition : {condition});
}
}
TakeWhile.make.Constructor = TakeWhile;
module.exports = TakeWhile.make;