new license file version [CI SKIP]
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"name":"@octokit/graphql","version":"4.8.0","files":{"dist-src/types.js":{"checkedAt":1678887829276,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"LICENSE":{"checkedAt":1678887829389,"integrity":"sha512-8FFmjOGzS4YsHoIqH94puCnrt52IbgXvyeCeydF8pso7rWBBQUq/ucDlumRLaH81XnrOqtE31m4OeKzAtd9ESA==","mode":420,"size":1081},"dist-src/error.js":{"checkedAt":1678887829389,"integrity":"sha512-iKznqLdiBmAzZ7zROG/ZWP1ubsC47yBIUBbEjoTbElpDRutMktm2kmced22cRMbPmW/1yTKRQq1BKLbQpc+Y5g==","mode":420,"size":843},"dist-src/graphql.js":{"checkedAt":1678887829389,"integrity":"sha512-hUsXwx9fHjqfaNP+FWOvgjgKx4FE/LruiK322NWfX3goJBmngpTUxL1v71bTnbGErzKwEztN2qJzHZNyFabm9g==","mode":420,"size":2026},"dist-src/index.js":{"checkedAt":1678887829389,"integrity":"sha512-JmnouMLwvAg53/bvS2bW9T9VjbGNcpm6KGOJHVCnSz6Z7ad+lyb+M/uysxR3t0JTFg262GWCc53DSZLGWA6sYA==","mode":420,"size":568},"dist-node/index.js":{"checkedAt":1678887829385,"integrity":"sha512-slr2RwQe2v9KE5A1ht7K/y3vqI2er9HwrOfGm5ARYxFyv/HckeLioCEcMdeVC/lf71vB43K+D/uE1fPh4Ae3VA==","mode":420,"size":3576},"dist-web/index.js":{"checkedAt":1678887829385,"integrity":"sha512-PANeUCdea09MpO25bfMMwb5AaC3ELp58xAt3hCSb+We65ZpY8/h7fSJQB83Fgk2LmEVaaYYQrcTu+vmJ3ejzUw==","mode":420,"size":3709},"dist-src/version.js":{"checkedAt":1678887829388,"integrity":"sha512-R87JGuKJPRfbT51BAVb+wHnEMZ70/gr1pa0dac22b7PfdtkaRo50UX3v2Kv1ywfPad/CYL1WixpEHV0hOfNlfA==","mode":420,"size":32},"dist-src/with-defaults.js":{"checkedAt":1678887829388,"integrity":"sha512-TC8aTZA/UC8NjdNuP/+hdD8qCqBhQmOYWr5YEvsUs8qy+bd+/a4TOGCQ593moVlX70Taf/r5RJxAWu/dx6NMvw==","mode":420,"size":435},"package.json":{"checkedAt":1678887829389,"integrity":"sha512-5y6Lm7lHSUDYZsg1EkSWsPN1qtGM+RkcBMKOCBP17kS9ObP11Wm/wPv7mOgICm0i2Mvlr9fsRQR+koLhT6ZWqA==","mode":420,"size":1173},"dist-node/index.js.map":{"checkedAt":1678887829389,"integrity":"sha512-qfkXip/s0sd4Obq8mcmAIvZ8J6csIRX8ne84WXCwHg/VSeos9X+eSXTGe1ZLl2ktWBgChOIe6ETl9ykGYBLO5w==","mode":420,"size":8195},"README.md":{"checkedAt":1678887829404,"integrity":"sha512-9UJ3QHUwafc+g4nWqEqv+gkPJv09IiOtFLGXC2oNxMxD0O8chjZqs//ONCh+2s6IYXn8ttvDrZPyI/RnFxqExg==","mode":420,"size":9536},"dist-types/graphql.d.ts":{"checkedAt":1678887829418,"integrity":"sha512-RQ9mEaHx8oNS9U+JogP7tA6eekMiwKI4LGa0sVW+pcVcSyzmbDBSKAqNz69lJQA2G7D6vONHfsgGoGrVEkyT6w==","mode":420,"size":312},"dist-types/index.d.ts":{"checkedAt":1678887829418,"integrity":"sha512-sgWjvPfWjCY75yabl5rSUiNVTxcaUeMTU6XvikYT3UigV0bPURWoAqo19bqRiBI1WBuhRxNJyYvNhcnhbxLOjg==","mode":420,"size":302},"dist-types/types.d.ts":{"checkedAt":1678887829404,"integrity":"sha512-oVbdDID6vE78sj21oY7i8YDVNEmm55iQOgnynZJg1iOJEPji+aHwOsSWD1VPxWk/bucYVDhjsRSxIbdsg5O02A==","mode":420,"size":2049},"dist-types/version.d.ts":{"checkedAt":1678887829404,"integrity":"sha512-vGS76KuJMXP4MI3WFDuMGZSmqtSZ+zDiT9OuZvtNsIUo82/D6tZYZhT7QChVJf9ZwFwSvYgPfha3Qm82JOENUw==","mode":420,"size":40},"dist-types/with-defaults.d.ts":{"checkedAt":1678887829418,"integrity":"sha512-COS8oE7Psr46cxwsJ04IYONRW8P4k8CvXs+LydGaK9lu/Vs5FWXqvatbd5JO2Km9rNdUCbsoeENEVAWhsmgh6Q==","mode":420,"size":234},"dist-web/index.js.map":{"checkedAt":1678887829418,"integrity":"sha512-iOsP0QRhlmEgAQqEJdluh2rRpvMdsQgeK2PC8v3S8Heworx4X9sDeRTxl1ANTvf7btXDDmtz0BKPprr44CMqug==","mode":420,"size":7927},"dist-types/error.d.ts":{"checkedAt":1678887829427,"integrity":"sha512-wxFu9wqqwmegNwLz/TQaRbhkaa6jsM8AxFVyOsxfVmRrJIvbnmzT6JwhvPEg/uQw5n+S+btNWSY+rfK7ycUtUA==","mode":420,"size":652}}}
|
||||
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
// Mediocre shim
|
||||
var worker_threads_1 = require("worker_threads");
|
||||
var workerAdd = ";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";
|
||||
exports["default"] = (function (c, _, msg, transfer, cb) {
|
||||
var done = false;
|
||||
var w = new worker_threads_1.Worker(c + workerAdd, { eval: true })
|
||||
.on('error', function (e) { return cb(e, null); })
|
||||
.on('message', function (m) { return cb(null, m); })
|
||||
.on('exit', function (c) {
|
||||
if (c && !done)
|
||||
cb(new Error('Exited with code ' + c), null);
|
||||
});
|
||||
w.postMessage(msg, transfer);
|
||||
w.terminate = function () {
|
||||
done = true;
|
||||
return worker_threads_1.Worker.prototype.terminate.call(w);
|
||||
};
|
||||
return w;
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
> `npm install --save @types/responselike`
|
||||
|
||||
# Summary
|
||||
This package contains type definitions for responselike ( https://github.com/lukechilds/responselike#readme ).
|
||||
|
||||
# Details
|
||||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/responselike
|
||||
|
||||
Additional Details
|
||||
* Last updated: Wed, 30 Jan 2019 18:47:32 GMT
|
||||
* Dependencies: @types/node
|
||||
* Global values: none
|
||||
|
||||
# Credits
|
||||
These definitions were written by BendingBender <https://github.com/BendingBender>.
|
||||
@@ -0,0 +1,33 @@
|
||||
let Selector = require('../selector')
|
||||
|
||||
class Placeholder extends Selector {
|
||||
/**
|
||||
* Add old mozilla to possible prefixes
|
||||
*/
|
||||
possible () {
|
||||
return super.possible().concat(['-moz- old', '-ms- old'])
|
||||
}
|
||||
|
||||
/**
|
||||
* Return different selectors depend on prefix
|
||||
*/
|
||||
prefixed (prefix) {
|
||||
if (prefix === '-webkit-') {
|
||||
return '::-webkit-input-placeholder'
|
||||
}
|
||||
if (prefix === '-ms-') {
|
||||
return '::-ms-input-placeholder'
|
||||
}
|
||||
if (prefix === '-ms- old') {
|
||||
return ':-ms-input-placeholder'
|
||||
}
|
||||
if (prefix === '-moz- old') {
|
||||
return ':-moz-placeholder'
|
||||
}
|
||||
return `::${prefix}placeholder`
|
||||
}
|
||||
}
|
||||
|
||||
Placeholder.names = ['::placeholder']
|
||||
|
||||
module.exports = Placeholder
|
||||
@@ -0,0 +1,197 @@
|
||||
import { fromArray } from './fromArray';
|
||||
import { isArray } from '../util/isArray';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { iterator as Symbol_iterator } from '../../internal/symbol/iterator';
|
||||
import { SimpleOuterSubscriber, SimpleInnerSubscriber, innerSubscribe } from '../innerSubscribe';
|
||||
export function zip(...observables) {
|
||||
const resultSelector = observables[observables.length - 1];
|
||||
if (typeof resultSelector === 'function') {
|
||||
observables.pop();
|
||||
}
|
||||
return fromArray(observables, undefined).lift(new ZipOperator(resultSelector));
|
||||
}
|
||||
export class ZipOperator {
|
||||
constructor(resultSelector) {
|
||||
this.resultSelector = resultSelector;
|
||||
}
|
||||
call(subscriber, source) {
|
||||
return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));
|
||||
}
|
||||
}
|
||||
export class ZipSubscriber extends Subscriber {
|
||||
constructor(destination, resultSelector, values = Object.create(null)) {
|
||||
super(destination);
|
||||
this.resultSelector = resultSelector;
|
||||
this.iterators = [];
|
||||
this.active = 0;
|
||||
this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : undefined;
|
||||
}
|
||||
_next(value) {
|
||||
const iterators = this.iterators;
|
||||
if (isArray(value)) {
|
||||
iterators.push(new StaticArrayIterator(value));
|
||||
}
|
||||
else if (typeof value[Symbol_iterator] === 'function') {
|
||||
iterators.push(new StaticIterator(value[Symbol_iterator]()));
|
||||
}
|
||||
else {
|
||||
iterators.push(new ZipBufferIterator(this.destination, this, value));
|
||||
}
|
||||
}
|
||||
_complete() {
|
||||
const iterators = this.iterators;
|
||||
const len = iterators.length;
|
||||
this.unsubscribe();
|
||||
if (len === 0) {
|
||||
this.destination.complete();
|
||||
return;
|
||||
}
|
||||
this.active = len;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let iterator = iterators[i];
|
||||
if (iterator.stillUnsubscribed) {
|
||||
const destination = this.destination;
|
||||
destination.add(iterator.subscribe());
|
||||
}
|
||||
else {
|
||||
this.active--;
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyInactive() {
|
||||
this.active--;
|
||||
if (this.active === 0) {
|
||||
this.destination.complete();
|
||||
}
|
||||
}
|
||||
checkIterators() {
|
||||
const iterators = this.iterators;
|
||||
const len = iterators.length;
|
||||
const destination = this.destination;
|
||||
for (let i = 0; i < len; i++) {
|
||||
let iterator = iterators[i];
|
||||
if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let shouldComplete = false;
|
||||
const args = [];
|
||||
for (let i = 0; i < len; i++) {
|
||||
let iterator = iterators[i];
|
||||
let result = iterator.next();
|
||||
if (iterator.hasCompleted()) {
|
||||
shouldComplete = true;
|
||||
}
|
||||
if (result.done) {
|
||||
destination.complete();
|
||||
return;
|
||||
}
|
||||
args.push(result.value);
|
||||
}
|
||||
if (this.resultSelector) {
|
||||
this._tryresultSelector(args);
|
||||
}
|
||||
else {
|
||||
destination.next(args);
|
||||
}
|
||||
if (shouldComplete) {
|
||||
destination.complete();
|
||||
}
|
||||
}
|
||||
_tryresultSelector(args) {
|
||||
let result;
|
||||
try {
|
||||
result = this.resultSelector.apply(this, args);
|
||||
}
|
||||
catch (err) {
|
||||
this.destination.error(err);
|
||||
return;
|
||||
}
|
||||
this.destination.next(result);
|
||||
}
|
||||
}
|
||||
class StaticIterator {
|
||||
constructor(iterator) {
|
||||
this.iterator = iterator;
|
||||
this.nextResult = iterator.next();
|
||||
}
|
||||
hasValue() {
|
||||
return true;
|
||||
}
|
||||
next() {
|
||||
const result = this.nextResult;
|
||||
this.nextResult = this.iterator.next();
|
||||
return result;
|
||||
}
|
||||
hasCompleted() {
|
||||
const nextResult = this.nextResult;
|
||||
return Boolean(nextResult && nextResult.done);
|
||||
}
|
||||
}
|
||||
class StaticArrayIterator {
|
||||
constructor(array) {
|
||||
this.array = array;
|
||||
this.index = 0;
|
||||
this.length = 0;
|
||||
this.length = array.length;
|
||||
}
|
||||
[Symbol_iterator]() {
|
||||
return this;
|
||||
}
|
||||
next(value) {
|
||||
const i = this.index++;
|
||||
const array = this.array;
|
||||
return i < this.length ? { value: array[i], done: false } : { value: null, done: true };
|
||||
}
|
||||
hasValue() {
|
||||
return this.array.length > this.index;
|
||||
}
|
||||
hasCompleted() {
|
||||
return this.array.length === this.index;
|
||||
}
|
||||
}
|
||||
class ZipBufferIterator extends SimpleOuterSubscriber {
|
||||
constructor(destination, parent, observable) {
|
||||
super(destination);
|
||||
this.parent = parent;
|
||||
this.observable = observable;
|
||||
this.stillUnsubscribed = true;
|
||||
this.buffer = [];
|
||||
this.isComplete = false;
|
||||
}
|
||||
[Symbol_iterator]() {
|
||||
return this;
|
||||
}
|
||||
next() {
|
||||
const buffer = this.buffer;
|
||||
if (buffer.length === 0 && this.isComplete) {
|
||||
return { value: null, done: true };
|
||||
}
|
||||
else {
|
||||
return { value: buffer.shift(), done: false };
|
||||
}
|
||||
}
|
||||
hasValue() {
|
||||
return this.buffer.length > 0;
|
||||
}
|
||||
hasCompleted() {
|
||||
return this.buffer.length === 0 && this.isComplete;
|
||||
}
|
||||
notifyComplete() {
|
||||
if (this.buffer.length > 0) {
|
||||
this.isComplete = true;
|
||||
this.parent.notifyInactive();
|
||||
}
|
||||
else {
|
||||
this.destination.complete();
|
||||
}
|
||||
}
|
||||
notifyNext(innerValue) {
|
||||
this.buffer.push(innerValue);
|
||||
this.parent.checkIterators();
|
||||
}
|
||||
subscribe() {
|
||||
return innerSubscribe(this.observable, new SimpleInnerSubscriber(this));
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=zip.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"take.js","sources":["../../../src/internal/operators/take.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAkD5C,MAAM,UAAU,IAAI,CAAI,KAAa;IACnC,OAAO,UAAC,MAAqB;QAC3B,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,KAAK,EAAE,CAAC;SAChB;aAAM;YACL,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;SAC7C;IACH,CAAC,CAAC;AACJ,CAAC;AAED;IACE,sBAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAC/B,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,EAAE;YAClB,MAAM,IAAI,uBAAuB,CAAC;SACnC;IACH,CAAC;IAED,2BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,CAAC;IACH,mBAAC;AAAD,CAAC,AAVD,IAUC;AAOD;IAAgC,0CAAa;IAG3C,wBAAY,WAA0B,EAAU,KAAa;QAA7D,YACE,kBAAM,WAAW,CAAC,SACnB;QAF+C,WAAK,GAAL,KAAK,CAAQ;QAFrD,WAAK,GAAW,CAAC,CAAC;;IAI1B,CAAC;IAES,8BAAK,GAAf,UAAgB,KAAQ;QACtB,IAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAM,KAAK,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC;QAC3B,IAAI,KAAK,IAAI,KAAK,EAAE;YAClB,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,KAAK,KAAK,KAAK,EAAE;gBACnB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC;gBAC5B,IAAI,CAAC,WAAW,EAAE,CAAC;aACpB;SACF;IACH,CAAC;IACH,qBAAC;AAAD,CAAC,AAlBD,CAAgC,UAAU,GAkBzC"}
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"retryWhen.js","sources":["../../src/add/operator/retryWhen.ts"],"names":[],"mappings":";;AAAA,8CAA4C"}
|
||||
@@ -0,0 +1,35 @@
|
||||
import {DelimiterCase} from './delimiter-case';
|
||||
|
||||
/**
|
||||
Convert a string literal to snake-case.
|
||||
|
||||
This can be useful when, for example, converting a camel-cased object property to a snake-cased SQL column name.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SnakeCase} from 'type-fest';
|
||||
|
||||
// Simple
|
||||
|
||||
const someVariable: SnakeCase<'fooBar'> = 'foo_bar';
|
||||
|
||||
// Advanced
|
||||
|
||||
type SnakeCasedProps<T> = {
|
||||
[K in keyof T as SnakeCase<K>]: T[K]
|
||||
};
|
||||
|
||||
interface ModelProps {
|
||||
isHappy: boolean;
|
||||
fullFamilyName: string;
|
||||
foo: number;
|
||||
}
|
||||
|
||||
const dbResult: SnakeCasedProps<ModelProps> = {
|
||||
'is_happy': true,
|
||||
'full_family_name': 'Carla Smith',
|
||||
foo: 123
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type SnakeCase<Value> = DelimiterCase<Value, '_'>;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"map.js","sources":["../../src/internal/operators/map.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAA2C;AA2C3C,SAAgB,GAAG,CAAO,OAAuC,EAAE,OAAa;IAC9E,OAAO,SAAS,YAAY,CAAC,MAAqB;QAChD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE;YACjC,MAAM,IAAI,SAAS,CAAC,4DAA4D,CAAC,CAAC;SACnF;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAPD,kBAOC;AAED;IACE,qBAAoB,OAAuC,EAAU,OAAY;QAA7D,YAAO,GAAP,OAAO,CAAgC;QAAU,YAAO,GAAP,OAAO,CAAK;IACjF,CAAC;IAED,0BAAI,GAAJ,UAAK,UAAyB,EAAE,MAAW;QACzC,OAAO,MAAM,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACrF,CAAC;IACH,kBAAC;AAAD,CAAC,AAPD,IAOC;AAPY,kCAAW;AAcxB;IAAkC,iCAAa;IAI7C,uBAAY,WAA0B,EAClB,OAAuC,EAC/C,OAAY;QAFxB,YAGE,kBAAM,WAAW,CAAC,SAEnB;QAJmB,aAAO,GAAP,OAAO,CAAgC;QAJ3D,WAAK,GAAW,CAAC,CAAC;QAOhB,KAAI,CAAC,OAAO,GAAG,OAAO,IAAI,KAAI,CAAC;;IACjC,CAAC;IAIS,6BAAK,GAAf,UAAgB,KAAQ;QACtB,IAAI,MAAS,CAAC;QACd,IAAI;YACF,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;SAC/D;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5B,OAAO;SACR;QACD,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IACH,oBAAC;AAAD,CAAC,AAvBD,CAAkC,uBAAU,GAuB3C"}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"2":0,"3":0.32208,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0.00657,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0.04601,"68":0.03944,"69":0,"70":0,"71":0,"72":0.03944,"73":0,"74":0,"75":0.2432,"76":0,"77":0,"78":0.23663,"79":0,"80":0,"81":0,"82":0.05916,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0.32208,"92":0,"93":0,"94":0,"95":0.00657,"96":0,"97":0,"98":0.3155,"99":0,"100":0,"101":0,"102":0.25635,"103":0,"104":0,"105":0,"106":0.04601,"107":0.05258,"108":1.43291,"109":0.63758,"110":0,"111":0,"3.5":0,"3.6":0},D:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0.01315,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0.00657,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0.01315,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0.00657,"66":0,"67":0,"68":0,"69":0,"70":0.01315,"71":0.05258,"72":0.01315,"73":0,"74":0.00657,"75":0,"76":0.05916,"77":0,"78":0.00657,"79":0.27607,"80":0.05916,"81":0.21034,"83":0.00657,"84":0.01972,"85":0.59814,"86":0.04601,"87":0.55871,"88":0,"89":0.00657,"90":0.01315,"91":0,"92":0.00657,"93":0,"94":0,"95":0,"96":0,"97":0.00657,"98":0.00657,"99":0,"100":0.00657,"101":0.01315,"102":0.00657,"103":1.68926,"104":0.11174,"105":1.33432,"106":0.1709,"107":2.09021,"108":8.11108,"109":9.64916,"110":0.00657,"111":0,"112":0},F:{"9":0,"11":0,"12":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"60":0,"62":0,"63":0,"64":0,"65":0.03287,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0.00657,"89":0,"90":0,"91":0,"92":0,"93":0.05258,"94":0.20376,"9.5-9.6":0,"10.0-10.1":0,"10.5":0,"10.6":0,"11.1":0,"11.5":0,"11.6":0,"12.1":0},B:{"12":0,"13":0,"14":0,"15":0,"16":0.00657,"17":0,"18":0.03287,"79":0,"80":0,"81":0,"83":0,"84":0,"85":0,"86":0.01972,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0.04601,"108":1.70898,"109":1.801},E:{"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0.00657,"13":0.01315,"14":0.35494,"15":0.01972,_:"0","3.1":0,"3.2":0,"5.1":0,"6.1":0,"7.1":0,"9.1":0,"10.1":0,"11.1":0,"12.1":0.04601,"13.1":0.39438,"14.1":0.82163,"15.1":0.03944,"15.2-15.3":0.07888,"15.4":0.06573,"15.5":0.32208,"15.6":3.08274,"16.0":0.21691,"16.1":1.27516,"16.2":1.6564,"16.3":0.17747},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0,"5.0-5.1":0,"6.0-6.1":0,"7.0-7.1":0,"8.1-8.4":0.01211,"9.0-9.2":0,"9.3":0.03229,"10.0-10.2":0.02422,"10.3":0.00807,"11.0-11.2":0,"11.3-11.4":0.12512,"12.0-12.1":0.02018,"12.2-12.5":0.45608,"13.0-13.1":0.00404,"13.2":0.00807,"13.3":0.04843,"13.4-13.7":0.28253,"14.0-14.4":0.39554,"14.5-14.8":0.74668,"15.0-15.1":0.67,"15.2-15.3":0.56909,"15.4":0.71439,"15.5":1.0171,"15.6":5.61021,"16.0":4.70208,"16.1":13.5089,"16.2":9.77145,"16.3":0.58524},P:{"4":0.01028,"5.0-5.4":0,"6.2-6.4":0,"7.2-7.4":0,"8.2":0,"9.2":0,"10.1":0,"11.1-11.2":0.34955,"12.0":0,"13.0":0,"14.0":0,"15.0":0,"16.0":0,"17.0":0.1645,"18.0":0,"19.0":1.32625},I:{"0":0,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.02315},K:{_:"0 10 11 12 11.1 11.5 12.1"},A:{"6":0,"7":0,"8":0,"9":0,"10":0,"11":0.03287,"5.5":0},J:{"7":0,"10":0},N:{"10":0,"11":0},R:{_:"0"},M:{"0":0.32899},Q:{"13.1":0},O:{"0":0.02056},H:{"0":0.02271},L:{"0":14.27433},S:{"2.5":0}};
|
||||
@@ -0,0 +1,158 @@
|
||||
import { Operator } from '../Operator';
|
||||
import { Subscriber } from '../Subscriber';
|
||||
import { Observable } from '../Observable';
|
||||
import { OperatorFunction, TeardownLogic } from '../types';
|
||||
|
||||
/**
|
||||
* Buffers the source Observable values until the size hits the maximum
|
||||
* `bufferSize` given.
|
||||
*
|
||||
* <span class="informal">Collects values from the past as an array, and emits
|
||||
* that array only when its size reaches `bufferSize`.</span>
|
||||
*
|
||||
* 
|
||||
*
|
||||
* Buffers a number of values from the source Observable by `bufferSize` then
|
||||
* emits the buffer and clears it, and starts a new buffer each
|
||||
* `startBufferEvery` values. If `startBufferEvery` is not provided or is
|
||||
* `null`, then new buffers are started immediately at the start of the source
|
||||
* and when each buffer closes and is emitted.
|
||||
*
|
||||
* ## Examples
|
||||
*
|
||||
* Emit the last two click events as an array
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { bufferCount } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const buffered = clicks.pipe(bufferCount(2));
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* On every click, emit the last two click events as an array
|
||||
*
|
||||
* ```ts
|
||||
* import { fromEvent } from 'rxjs';
|
||||
* import { bufferCount } from 'rxjs/operators';
|
||||
*
|
||||
* const clicks = fromEvent(document, 'click');
|
||||
* const buffered = clicks.pipe(bufferCount(2, 1));
|
||||
* buffered.subscribe(x => console.log(x));
|
||||
* ```
|
||||
*
|
||||
* @see {@link buffer}
|
||||
* @see {@link bufferTime}
|
||||
* @see {@link bufferToggle}
|
||||
* @see {@link bufferWhen}
|
||||
* @see {@link pairwise}
|
||||
* @see {@link windowCount}
|
||||
*
|
||||
* @param {number} bufferSize The maximum size of the buffer emitted.
|
||||
* @param {number} [startBufferEvery] Interval at which to start a new buffer.
|
||||
* For example if `startBufferEvery` is `2`, then a new buffer will be started
|
||||
* on every other value from the source. A new buffer is started at the
|
||||
* beginning of the source by default.
|
||||
* @return {Observable<T[]>} An Observable of arrays of buffered values.
|
||||
* @method bufferCount
|
||||
* @owner Observable
|
||||
*/
|
||||
export function bufferCount<T>(bufferSize: number, startBufferEvery: number = null): OperatorFunction<T, T[]> {
|
||||
return function bufferCountOperatorFunction(source: Observable<T>) {
|
||||
return source.lift(new BufferCountOperator<T>(bufferSize, startBufferEvery));
|
||||
};
|
||||
}
|
||||
|
||||
class BufferCountOperator<T> implements Operator<T, T[]> {
|
||||
private subscriberClass: any;
|
||||
|
||||
constructor(private bufferSize: number, private startBufferEvery: number) {
|
||||
if (!startBufferEvery || bufferSize === startBufferEvery) {
|
||||
this.subscriberClass = BufferCountSubscriber;
|
||||
} else {
|
||||
this.subscriberClass = BufferSkipCountSubscriber;
|
||||
}
|
||||
}
|
||||
|
||||
call(subscriber: Subscriber<T[]>, source: any): TeardownLogic {
|
||||
return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class BufferCountSubscriber<T> extends Subscriber<T> {
|
||||
private buffer: T[] = [];
|
||||
|
||||
constructor(destination: Subscriber<T[]>, private bufferSize: number) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
protected _next(value: T): void {
|
||||
const buffer = this.buffer;
|
||||
|
||||
buffer.push(value);
|
||||
|
||||
if (buffer.length == this.bufferSize) {
|
||||
this.destination.next(buffer);
|
||||
this.buffer = [];
|
||||
}
|
||||
}
|
||||
|
||||
protected _complete(): void {
|
||||
const buffer = this.buffer;
|
||||
if (buffer.length > 0) {
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
super._complete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We need this JSDoc comment for affecting ESDoc.
|
||||
* @ignore
|
||||
* @extends {Ignored}
|
||||
*/
|
||||
class BufferSkipCountSubscriber<T> extends Subscriber<T> {
|
||||
private buffers: Array<T[]> = [];
|
||||
private count: number = 0;
|
||||
|
||||
constructor(destination: Subscriber<T[]>, private bufferSize: number, private startBufferEvery: number) {
|
||||
super(destination);
|
||||
}
|
||||
|
||||
protected _next(value: T): void {
|
||||
const { bufferSize, startBufferEvery, buffers, count } = this;
|
||||
|
||||
this.count++;
|
||||
if (count % startBufferEvery === 0) {
|
||||
buffers.push([]);
|
||||
}
|
||||
|
||||
for (let i = buffers.length; i--; ) {
|
||||
const buffer = buffers[i];
|
||||
buffer.push(value);
|
||||
if (buffer.length === bufferSize) {
|
||||
buffers.splice(i, 1);
|
||||
this.destination.next(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected _complete(): void {
|
||||
const { buffers, destination } = this;
|
||||
|
||||
while (buffers.length > 0) {
|
||||
let buffer = buffers.shift();
|
||||
if (buffer.length > 0) {
|
||||
destination.next(buffer);
|
||||
}
|
||||
}
|
||||
super._complete();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
# http-timer
|
||||
> Timings for HTTP requests
|
||||
|
||||
[](https://travis-ci.org/szmarczak/http-timer)
|
||||
[](https://coveralls.io/github/szmarczak/http-timer?branch=master)
|
||||
[](https://packagephobia.now.sh/result?p=@szmarczak/http-timer)
|
||||
|
||||
Inspired by the [`request` package](https://github.com/request/request).
|
||||
|
||||
## Usage
|
||||
```js
|
||||
'use strict';
|
||||
const https = require('https');
|
||||
const timer = require('@szmarczak/http-timer');
|
||||
|
||||
const request = https.get('https://httpbin.org/anything');
|
||||
const timings = timer(request);
|
||||
|
||||
request.on('response', response => {
|
||||
response.on('data', () => {}); // Consume the data somehow
|
||||
response.on('end', () => {
|
||||
console.log(timings);
|
||||
});
|
||||
});
|
||||
|
||||
// { start: 1535708511443,
|
||||
// socket: 1535708511444,
|
||||
// lookup: 1535708511444,
|
||||
// connect: 1535708511582,
|
||||
// upload: 1535708511887,
|
||||
// response: 1535708512037,
|
||||
// end: 1535708512040,
|
||||
// phases:
|
||||
// { wait: 1,
|
||||
// dns: 0,
|
||||
// tcp: 138,
|
||||
// request: 305,
|
||||
// firstByte: 150,
|
||||
// download: 3,
|
||||
// total: 597 } }
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### timer(request)
|
||||
|
||||
Returns: `Object`
|
||||
|
||||
- `start` - Time when the request started.
|
||||
- `socket` - Time when a socket was assigned to the request.
|
||||
- `lookup` - Time when the DNS lookup finished.
|
||||
- `connect` - Time when the socket successfully connected.
|
||||
- `upload` - Time when the request finished uploading.
|
||||
- `response` - Time when the request fired the `response` event.
|
||||
- `end` - Time when the response fired the `end` event.
|
||||
- `error` - Time when the request fired the `error` event.
|
||||
- `phases`
|
||||
- `wait` - `timings.socket - timings.start`
|
||||
- `dns` - `timings.lookup - timings.socket`
|
||||
- `tcp` - `timings.connect - timings.lookup`
|
||||
- `request` - `timings.upload - timings.connect`
|
||||
- `firstByte` - `timings.response - timings.upload`
|
||||
- `download` - `timings.end - timings.response`
|
||||
- `total` - `timings.end - timings.start` or `timings.error - timings.start`
|
||||
|
||||
**Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/operators/count';
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Observable } from '../Observable';
|
||||
import { SchedulerLike } from '../types';
|
||||
import { subscribeToArray } from '../util/subscribeToArray';
|
||||
import { scheduleArray } from '../scheduled/scheduleArray';
|
||||
|
||||
export function fromArray<T>(input: ArrayLike<T>, scheduler?: SchedulerLike) {
|
||||
if (!scheduler) {
|
||||
return new Observable<T>(subscribeToArray(input));
|
||||
} else {
|
||||
return scheduleArray(input, scheduler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,489 @@
|
||||
<img width="75px" height="75px" align="right" alt="Inquirer Logo" src="https://raw.githubusercontent.com/SBoudrias/Inquirer.js/master/assets/inquirer_readme.svg?sanitize=true" title="Inquirer.js"/>
|
||||
|
||||
# Inquirer.js
|
||||
|
||||
[](http://badge.fury.io/js/inquirer)
|
||||
[](http://travis-ci.org/SBoudrias/Inquirer.js)
|
||||
[](https://codecov.io/gh/SBoudrias/Inquirer.js)
|
||||
[](https://app.fossa.com/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js?ref=badge_shield)
|
||||
|
||||
A collection of common interactive command line user interfaces.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Documentation](#documentation)
|
||||
1. [Installation](#installation)
|
||||
2. [Examples](#examples)
|
||||
3. [Methods](#methods)
|
||||
4. [Objects](#objects)
|
||||
5. [Questions](#questions)
|
||||
6. [Answers](#answers)
|
||||
7. [Separator](#separator)
|
||||
8. [Prompt Types](#prompt)
|
||||
2. [User Interfaces and Layouts](#layouts)
|
||||
1. [Reactive Interface](#reactive)
|
||||
3. [Support](#support)
|
||||
4. [Known issues](#issues)
|
||||
4. [News](#news)
|
||||
5. [Contributing](#contributing)
|
||||
6. [License](#license)
|
||||
7. [Plugins](#plugins)
|
||||
|
||||
## Goal and Philosophy
|
||||
|
||||
**`Inquirer.js`** strives to be an easily embeddable and beautiful command line interface for [Node.js](https://nodejs.org/) (and perhaps the "CLI [Xanadu](https://en.wikipedia.org/wiki/Citizen_Kane)").
|
||||
|
||||
**`Inquirer.js`** should ease the process of
|
||||
|
||||
- providing _error feedback_
|
||||
- _asking questions_
|
||||
- _parsing_ input
|
||||
- _validating_ answers
|
||||
- managing _hierarchical prompts_
|
||||
|
||||
> **Note:** **`Inquirer.js`** provides the user interface and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [commander](https://github.com/visionmedia/commander.js), [vorpal](https://github.com/dthree/vorpal) or [args](https://github.com/leo/args).
|
||||
|
||||
## [Documentation](#documentation)
|
||||
|
||||
<a name="documentation"></a>
|
||||
|
||||
### Installation
|
||||
|
||||
<a name="installation"></a>
|
||||
|
||||
```shell
|
||||
npm install inquirer
|
||||
```
|
||||
|
||||
```javascript
|
||||
var inquirer = require('inquirer');
|
||||
inquirer
|
||||
.prompt([
|
||||
/* Pass your questions in here */
|
||||
])
|
||||
.then(answers => {
|
||||
// Use user feedback for... whatever!!
|
||||
})
|
||||
.catch(error => {
|
||||
if(error.isTtyError) {
|
||||
// Prompt couldn't be rendered in the current environment
|
||||
} else {
|
||||
// Something else went wrong
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
<a name="examples"></a>
|
||||
|
||||
### Examples (Run it and see it)
|
||||
|
||||
Check out the [`packages/inquirer/examples/`](https://github.com/SBoudrias/Inquirer.js/tree/master/packages/inquirer/examples) folder for code and interface examples.
|
||||
|
||||
```shell
|
||||
node packages/inquirer/examples/pizza.js
|
||||
node packages/inquirer/examples/checkbox.js
|
||||
# etc...
|
||||
```
|
||||
|
||||
### Methods
|
||||
|
||||
<a name="methods"></a>
|
||||
|
||||
#### `inquirer.prompt(questions, answers) -> promise`
|
||||
|
||||
Launch the prompt interface (inquiry session)
|
||||
|
||||
- **questions** (Array) containing [Question Object](#question) (using the [reactive interface](#reactive-interface), you can also pass a `Rx.Observable` instance)
|
||||
- **answers** (object) contains values of already answered questions. Inquirer will avoid asking answers already provided here. Defaults `{}`.
|
||||
- returns a **Promise**
|
||||
|
||||
#### `inquirer.registerPrompt(name, prompt)`
|
||||
|
||||
Register prompt plugins under `name`.
|
||||
|
||||
- **name** (string) name of the this new prompt. (used for question `type`)
|
||||
- **prompt** (object) the prompt object itself (the plugin)
|
||||
|
||||
#### `inquirer.createPromptModule() -> prompt function`
|
||||
|
||||
Create a self contained inquirer module. If you don't want to affect other libraries that also rely on inquirer when you overwrite or add new prompt types.
|
||||
|
||||
```js
|
||||
var prompt = inquirer.createPromptModule();
|
||||
|
||||
prompt(questions).then(/* ... */);
|
||||
```
|
||||
|
||||
### Objects
|
||||
|
||||
<a name="objects"></a>
|
||||
|
||||
#### Question
|
||||
|
||||
<a name="questions"></a>
|
||||
A question object is a `hash` containing question related values:
|
||||
|
||||
- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `number`, `confirm`,
|
||||
`list`, `rawlist`, `expand`, `checkbox`, `password`, `editor`
|
||||
- **name**: (String) The name to use when storing the answer in the answers hash. If the name contains periods, it will define a path in the answers hash.
|
||||
- **message**: (String|Function) The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of `name` (followed by a colon).
|
||||
- **default**: (String|Number|Boolean|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
|
||||
Array values can be simple `numbers`, `strings`, or `objects` containing a `name` (to display in list), a `value` (to save in the answers hash), and a `short` (to display after selection) properties. The choices array can also contain [a `Separator`](#separator).
|
||||
- **validate**: (Function) Receive the user input and answers hash. Should return `true` if the value is valid, and an error message (`String`) otherwise. If `false` is returned, a default error message is provided.
|
||||
- **filter**: (Function) Receive the user input and answers hash. Returns the filtered value to be used inside the program. The value returned will be added to the _Answers_ hash.
|
||||
- **transformer**: (Function) Receive the user input, answers hash and option flags, and return a transformed value to display to the user. The transformation only impacts what is shown while editing. It does not modify the answers hash.
|
||||
- **when**: (Function, Boolean) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked. The value can also be a simple boolean.
|
||||
- **pageSize**: (Number) Change the number of lines that will be rendered when using `list`, `rawList`, `expand` or `checkbox`.
|
||||
- **prefix**: (String) Change the default _prefix_ message.
|
||||
- **suffix**: (String) Change the default _suffix_ message.
|
||||
- **askAnswered**: (Boolean) Force to prompt the question if the answer already exists.
|
||||
- **loop**: (Boolean) Enable list looping. Defaults: `true`
|
||||
|
||||
`default`, `choices`(if defined as functions), `validate`, `filter` and `when` functions can be called asynchronously. Either return a promise or use `this.async()` to get a callback you'll call with the final value.
|
||||
|
||||
```javascript
|
||||
{
|
||||
/* Preferred way: with promise */
|
||||
filter() {
|
||||
return new Promise(/* etc... */);
|
||||
},
|
||||
|
||||
/* Legacy way: with this.async */
|
||||
validate: function (input) {
|
||||
// Declare function as asynchronous, and save the done callback
|
||||
var done = this.async();
|
||||
|
||||
// Do async stuff
|
||||
setTimeout(function() {
|
||||
if (typeof input !== 'number') {
|
||||
// Pass the return value in the done callback
|
||||
done('You need to provide a number');
|
||||
return;
|
||||
}
|
||||
// Pass the return value in the done callback
|
||||
done(null, true);
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Answers
|
||||
|
||||
<a name="answers"></a>
|
||||
A key/value hash containing the client answers in each prompt.
|
||||
|
||||
- **Key** The `name` property of the _question_ object
|
||||
- **Value** (Depends on the prompt)
|
||||
- `confirm`: (Boolean)
|
||||
- `input` : User input (filtered if `filter` is defined) (String)
|
||||
- `number`: User input (filtered if `filter` is defined) (Number)
|
||||
- `rawlist`, `list` : Selected choice value (or name if no value specified) (String)
|
||||
|
||||
### Separator
|
||||
|
||||
<a name="separator"></a>
|
||||
A separator can be added to any `choices` array:
|
||||
|
||||
```
|
||||
// In the question object
|
||||
choices: [ "Choice A", new inquirer.Separator(), "choice B" ]
|
||||
|
||||
// Which'll be displayed this way
|
||||
[?] What do you want to do?
|
||||
> Order a pizza
|
||||
Make a reservation
|
||||
--------
|
||||
Ask opening hours
|
||||
Talk to the receptionist
|
||||
```
|
||||
|
||||
The constructor takes a facultative `String` value that'll be use as the separator. If omitted, the separator will be `--------`.
|
||||
|
||||
Separator instances have a property `type` equal to `separator`. This should allow tools façading Inquirer interface from detecting separator types in lists.
|
||||
|
||||
<a name="prompt"></a>
|
||||
|
||||
### Prompt types
|
||||
|
||||
---
|
||||
|
||||
> **Note:**: _allowed options written inside square brackets (`[]`) are optional. Others are required._
|
||||
|
||||
#### List - `{type: 'list'}`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`, `filter`, `loop`] properties. (Note that
|
||||
default must be the choice `index` in the array or a choice `value`)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Raw List - `{type: 'rawlist'}`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`, `filter`, `loop`] properties. (Note that
|
||||
default must be the choice `index` in the array)
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Expand - `{type: 'expand'}`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `default`] properties. (Note that
|
||||
default must be the choice `index` in the array. If `default` key not provided, then `help` will be used as default choice)
|
||||
|
||||
Note that the `choices` object will take an extra parameter called `key` for the `expand` prompt. This parameter must be a single (lowercased) character. The `h` option is added by the prompt and shouldn't be defined by the user.
|
||||
|
||||
See `examples/expand.js` for a running example.
|
||||
|
||||

|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Checkbox - `{type: 'checkbox'}`
|
||||
|
||||
Take `type`, `name`, `message`, `choices`[, `filter`, `validate`, `default`, `loop`] properties. `default` is expected to be an Array of the checked choices value.
|
||||
|
||||
Choices marked as `{checked: true}` will be checked by default.
|
||||
|
||||
Choices whose property `disabled` is truthy will be unselectable. If `disabled` is a string, then the string will be outputted next to the disabled choice, otherwise it'll default to `"Disabled"`. The `disabled` property can also be a synchronous function receiving the current answers as argument and returning a boolean or a string.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Confirm - `{type: 'confirm'}`
|
||||
|
||||
Take `type`, `name`, `message`, [`default`] properties. `default` is expected to be a boolean if used.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Input - `{type: 'input'}`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `transformer`] properties.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
#### Input - `{type: 'number'}`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `transformer`] properties.
|
||||
|
||||
---
|
||||
|
||||
#### Password - `{type: 'password'}`
|
||||
|
||||
Take `type`, `name`, `message`, `mask`,[, `default`, `filter`, `validate`] properties.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Note that `mask` is required to hide the actual user input.
|
||||
|
||||
#### Editor - `{type: 'editor'}`
|
||||
|
||||
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `postfix`] properties
|
||||
|
||||
Launches an instance of the users preferred editor on a temporary file. Once the user exits their editor, the contents of the temporary file are read in as the result. The editor to use is determined by reading the $VISUAL or $EDITOR environment variables. If neither of those are present, notepad (on Windows) or vim (Linux or Mac) is used.
|
||||
|
||||
The `postfix` property is useful if you want to provide an extension.
|
||||
|
||||
<a name="layouts"></a>
|
||||
|
||||
### Use in Non-Interactive Environments
|
||||
`prompt()` requires that it is run in an interactive environment. (I.e. [One where `process.stdin.isTTY` is `true`](https://nodejs.org/docs/latest-v12.x/api/process.html#process_a_note_on_process_i_o)). If `prompt()` is invoked outside of such an environment, then `prompt()` will return a rejected promise with an error. For convenience, the error will have a `isTtyError` property to programmatically indicate the cause.
|
||||
|
||||
|
||||
## User Interfaces and layouts
|
||||
|
||||
Along with the prompts, Inquirer offers some basic text UI.
|
||||
|
||||
#### Bottom Bar - `inquirer.ui.BottomBar`
|
||||
|
||||
This UI present a fixed text at the bottom of a free text zone. This is useful to keep a message to the bottom of the screen while outputting command outputs on the higher section.
|
||||
|
||||
```javascript
|
||||
var ui = new inquirer.ui.BottomBar();
|
||||
|
||||
// pipe a Stream to the log zone
|
||||
outputStream.pipe(ui.log);
|
||||
|
||||
// Or simply write output
|
||||
ui.log.write('something just happened.');
|
||||
ui.log.write('Almost over, standby!');
|
||||
|
||||
// During processing, update the bottom bar content to display a loader
|
||||
// or output a progress bar, etc
|
||||
ui.updateBottomBar('new bottom bar content');
|
||||
```
|
||||
|
||||
<a name="reactive"></a>
|
||||
|
||||
## Reactive interface
|
||||
|
||||
Internally, Inquirer uses the [JS reactive extension](https://github.com/ReactiveX/rxjs) to handle events and async flows.
|
||||
|
||||
This mean you can take advantage of this feature to provide more advanced flows. For example, you can dynamically add questions to be asked:
|
||||
|
||||
```js
|
||||
var prompts = new Rx.Subject();
|
||||
inquirer.prompt(prompts);
|
||||
|
||||
// At some point in the future, push new questions
|
||||
prompts.next({
|
||||
/* question... */
|
||||
});
|
||||
prompts.next({
|
||||
/* question... */
|
||||
});
|
||||
|
||||
// When you're done
|
||||
prompts.complete();
|
||||
```
|
||||
|
||||
And using the return value `process` property, you can access more fine grained callbacks:
|
||||
|
||||
```js
|
||||
inquirer.prompt(prompts).ui.process.subscribe(onEachAnswer, onError, onComplete);
|
||||
```
|
||||
|
||||
## Support (OS Terminals)
|
||||
|
||||
<a name="support"></a>
|
||||
|
||||
You should expect mostly good support for the CLI below. This does not mean we won't
|
||||
look at issues found on other command line - feel free to report any!
|
||||
|
||||
- **Mac OS**:
|
||||
- Terminal.app
|
||||
- iTerm
|
||||
- **Windows ([Known issues](#issues))**:
|
||||
- [ConEmu](https://conemu.github.io/)
|
||||
- cmd.exe
|
||||
- Powershell
|
||||
- Cygwin
|
||||
- **Linux (Ubuntu, openSUSE, Arch Linux, etc)**:
|
||||
- gnome-terminal (Terminal GNOME)
|
||||
- konsole
|
||||
|
||||
## Known issues
|
||||
|
||||
<a name="issues"></a>
|
||||
|
||||
Running Inquirer together with network streams in Windows platform inside some terminals can result in process hang.
|
||||
Workaround: run inside another terminal.
|
||||
Please refer to the https://github.com/nodejs/node/issues/21771
|
||||
|
||||
## News on the march (Release notes)
|
||||
|
||||
<a name="news"></a>
|
||||
|
||||
Please refer to the [GitHub releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases)
|
||||
|
||||
## Contributing
|
||||
|
||||
<a name="contributing"></a>
|
||||
|
||||
**Unit test**
|
||||
Unit test are written in [Mocha](https://mochajs.org/). Please add a unit test for every new feature or bug fix. `npm test` to run the test suite.
|
||||
|
||||
**Documentation**
|
||||
Add documentation for every API change. Feel free to send typo fixes and better docs!
|
||||
|
||||
We're looking to offer good support for multiple prompts and environments. If you want to
|
||||
help, we'd like to keep a list of testers for each terminal/OS so we can contact you and
|
||||
get feedback before release. Let us know if you want to be added to the list (just tweet
|
||||
to [@vaxilart](https://twitter.com/Vaxilart)) or just add your name to [the wiki](https://github.com/SBoudrias/Inquirer.js/wiki/Testers)
|
||||
|
||||
## License
|
||||
|
||||
<a name="license"></a>
|
||||
|
||||
Copyright (c) 2016 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))
|
||||
Licensed under the MIT license.
|
||||
|
||||
## Plugins
|
||||
|
||||
<a name="plugins"></a>
|
||||
|
||||
### Prompts
|
||||
|
||||
[**autocomplete**](https://github.com/mokkabonna/inquirer-autocomplete-prompt)<br>
|
||||
Presents a list of options as the user types, compatible with other packages such as fuzzy (for search)<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**checkbox-plus**](https://github.com/faressoft/inquirer-checkbox-plus-prompt)<br>
|
||||
Checkbox list with autocomplete and other additions<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-date-prompt**](https://github.com/haversnail/inquirer-date-prompt)<br>
|
||||
Customizable date/time selector with localization support<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**datetime**](https://github.com/DerekTBrown/inquirer-datepicker-prompt)<br>
|
||||
Customizable date/time selector using both number pad and arrow keys<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-select-line**](https://github.com/adam-golab/inquirer-select-line)<br>
|
||||
Prompt for selecting index in array where add new element<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**command**](https://github.com/sullof/inquirer-command-prompt)<br>
|
||||
Simple prompt with command history and dynamic autocomplete<br>
|
||||
|
||||
[**inquirer-fuzzy-path**](https://github.com/adelsz/inquirer-fuzzy-path)<br>
|
||||
Prompt for fuzzy file/directory selection.<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-emoji**](https://github.com/tannerntannern/inquirer-emoji)<br>
|
||||
Prompt for inputting emojis.<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-chalk-pipe**](https://github.com/LitoMore/inquirer-chalk-pipe)<br>
|
||||
Prompt for input chalk-pipe style strings<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-search-checkbox**](https://github.com/clinyong/inquirer-search-checkbox)<br>
|
||||
Searchable Inquirer checkbox<br>
|
||||
|
||||
[**inquirer-search-list**](https://github.com/robin-rpr/inquirer-search-list)<br>
|
||||
Searchable Inquirer list<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-prompt-suggest**](https://github.com/olistic/inquirer-prompt-suggest)<br>
|
||||
Inquirer prompt for your less creative users.<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-s3**](https://github.com/HQarroum/inquirer-s3)<br>
|
||||
An S3 object selector for Inquirer.<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-autosubmit-prompt**](https://github.com/yaodingyd/inquirer-autosubmit-prompt)<br>
|
||||
Auto submit based on your current input, saving one extra enter<br>
|
||||
|
||||
[**inquirer-file-tree-selection-prompt**](https://github.com/anc95/inquirer-file-tree-selection)<br>
|
||||
Inquirer prompt for to select a file or directory in file tree<br>
|
||||
<br>
|
||||

|
||||
|
||||
[**inquirer-table-prompt**](https://github.com/eduardoboucas/inquirer-table-prompt)<br>
|
||||
A table-like prompt for Inquirer.<br>
|
||||
<br>
|
||||

|
||||
@@ -0,0 +1 @@
|
||||
export * from 'rxjs-compat/observable/dom/WebSocketSubject';
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,113 @@
|
||||
'use strict';
|
||||
|
||||
const UPPERCASE = /[\p{Lu}]/u;
|
||||
const LOWERCASE = /[\p{Ll}]/u;
|
||||
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
||||
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
||||
const SEPARATORS = /[_.\- ]+/;
|
||||
|
||||
const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
|
||||
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
|
||||
const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
|
||||
|
||||
const preserveCamelCase = (string, toLowerCase, toUpperCase) => {
|
||||
let isLastCharLower = false;
|
||||
let isLastCharUpper = false;
|
||||
let isLastLastCharUpper = false;
|
||||
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
const character = string[i];
|
||||
|
||||
if (isLastCharLower && UPPERCASE.test(character)) {
|
||||
string = string.slice(0, i) + '-' + string.slice(i);
|
||||
isLastCharLower = false;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = true;
|
||||
i++;
|
||||
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character)) {
|
||||
string = string.slice(0, i - 1) + '-' + string.slice(i - 1);
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = false;
|
||||
isLastCharLower = true;
|
||||
} else {
|
||||
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
||||
isLastLastCharUpper = isLastCharUpper;
|
||||
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
};
|
||||
|
||||
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
||||
LEADING_CAPITAL.lastIndex = 0;
|
||||
|
||||
return input.replace(LEADING_CAPITAL, m1 => toLowerCase(m1));
|
||||
};
|
||||
|
||||
const postProcess = (input, toUpperCase) => {
|
||||
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
||||
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
||||
|
||||
return input.replace(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier))
|
||||
.replace(NUMBERS_AND_IDENTIFIER, m => toUpperCase(m));
|
||||
};
|
||||
|
||||
const camelCase = (input, options) => {
|
||||
if (!(typeof input === 'string' || Array.isArray(input))) {
|
||||
throw new TypeError('Expected the input to be `string | string[]`');
|
||||
}
|
||||
|
||||
options = {
|
||||
pascalCase: false,
|
||||
preserveConsecutiveUppercase: false,
|
||||
...options
|
||||
};
|
||||
|
||||
if (Array.isArray(input)) {
|
||||
input = input.map(x => x.trim())
|
||||
.filter(x => x.length)
|
||||
.join('-');
|
||||
} else {
|
||||
input = input.trim();
|
||||
}
|
||||
|
||||
if (input.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const toLowerCase = options.locale === false ?
|
||||
string => string.toLowerCase() :
|
||||
string => string.toLocaleLowerCase(options.locale);
|
||||
const toUpperCase = options.locale === false ?
|
||||
string => string.toUpperCase() :
|
||||
string => string.toLocaleUpperCase(options.locale);
|
||||
|
||||
if (input.length === 1) {
|
||||
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
||||
}
|
||||
|
||||
const hasUpperCase = input !== toLowerCase(input);
|
||||
|
||||
if (hasUpperCase) {
|
||||
input = preserveCamelCase(input, toLowerCase, toUpperCase);
|
||||
}
|
||||
|
||||
input = input.replace(LEADING_SEPARATORS, '');
|
||||
|
||||
if (options.preserveConsecutiveUppercase) {
|
||||
input = preserveConsecutiveUppercase(input, toLowerCase);
|
||||
} else {
|
||||
input = toLowerCase(input);
|
||||
}
|
||||
|
||||
if (options.pascalCase) {
|
||||
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
||||
}
|
||||
|
||||
return postProcess(input, toUpperCase);
|
||||
};
|
||||
|
||||
module.exports = camelCase;
|
||||
// TODO: Remove this for the next major release
|
||||
module.exports.default = camelCase;
|
||||
@@ -0,0 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
require("rxjs-compat/add/operator/finally");
|
||||
//# sourceMappingURL=finally.js.map
|
||||
@@ -0,0 +1,21 @@
|
||||
import { RequestHeaders } from "./RequestHeaders";
|
||||
import { RequestMethod } from "./RequestMethod";
|
||||
import { RequestParameters } from "./RequestParameters";
|
||||
import { Url } from "./Url";
|
||||
/**
|
||||
* The `.endpoint()` method is guaranteed to set all keys defined by RequestParameters
|
||||
* as well as the method property.
|
||||
*/
|
||||
export declare type EndpointDefaults = RequestParameters & {
|
||||
baseUrl: Url;
|
||||
method: RequestMethod;
|
||||
url?: Url;
|
||||
headers: RequestHeaders & {
|
||||
accept: string;
|
||||
"user-agent": string;
|
||||
};
|
||||
mediaType: {
|
||||
format: string;
|
||||
previews: string[];
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
function __export(m) {
|
||||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
|
||||
}
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__export(require("rxjs-compat/operators/timeout"));
|
||||
//# sourceMappingURL=timeout.js.map
|
||||
@@ -0,0 +1,94 @@
|
||||
var once = require('once');
|
||||
|
||||
var noop = function() {};
|
||||
|
||||
var isRequest = function(stream) {
|
||||
return stream.setHeader && typeof stream.abort === 'function';
|
||||
};
|
||||
|
||||
var isChildProcess = function(stream) {
|
||||
return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3
|
||||
};
|
||||
|
||||
var eos = function(stream, opts, callback) {
|
||||
if (typeof opts === 'function') return eos(stream, null, opts);
|
||||
if (!opts) opts = {};
|
||||
|
||||
callback = once(callback || noop);
|
||||
|
||||
var ws = stream._writableState;
|
||||
var rs = stream._readableState;
|
||||
var readable = opts.readable || (opts.readable !== false && stream.readable);
|
||||
var writable = opts.writable || (opts.writable !== false && stream.writable);
|
||||
var cancelled = false;
|
||||
|
||||
var onlegacyfinish = function() {
|
||||
if (!stream.writable) onfinish();
|
||||
};
|
||||
|
||||
var onfinish = function() {
|
||||
writable = false;
|
||||
if (!readable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onend = function() {
|
||||
readable = false;
|
||||
if (!writable) callback.call(stream);
|
||||
};
|
||||
|
||||
var onexit = function(exitCode) {
|
||||
callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null);
|
||||
};
|
||||
|
||||
var onerror = function(err) {
|
||||
callback.call(stream, err);
|
||||
};
|
||||
|
||||
var onclose = function() {
|
||||
process.nextTick(onclosenexttick);
|
||||
};
|
||||
|
||||
var onclosenexttick = function() {
|
||||
if (cancelled) return;
|
||||
if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close'));
|
||||
};
|
||||
|
||||
var onrequest = function() {
|
||||
stream.req.on('finish', onfinish);
|
||||
};
|
||||
|
||||
if (isRequest(stream)) {
|
||||
stream.on('complete', onfinish);
|
||||
stream.on('abort', onclose);
|
||||
if (stream.req) onrequest();
|
||||
else stream.on('request', onrequest);
|
||||
} else if (writable && !ws) { // legacy streams
|
||||
stream.on('end', onlegacyfinish);
|
||||
stream.on('close', onlegacyfinish);
|
||||
}
|
||||
|
||||
if (isChildProcess(stream)) stream.on('exit', onexit);
|
||||
|
||||
stream.on('end', onend);
|
||||
stream.on('finish', onfinish);
|
||||
if (opts.error !== false) stream.on('error', onerror);
|
||||
stream.on('close', onclose);
|
||||
|
||||
return function() {
|
||||
cancelled = true;
|
||||
stream.removeListener('complete', onfinish);
|
||||
stream.removeListener('abort', onclose);
|
||||
stream.removeListener('request', onrequest);
|
||||
if (stream.req) stream.req.removeListener('finish', onfinish);
|
||||
stream.removeListener('end', onlegacyfinish);
|
||||
stream.removeListener('close', onlegacyfinish);
|
||||
stream.removeListener('finish', onfinish);
|
||||
stream.removeListener('exit', onexit);
|
||||
stream.removeListener('end', onend);
|
||||
stream.removeListener('error', onerror);
|
||||
stream.removeListener('close', onclose);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = eos;
|
||||
Reference in New Issue
Block a user