new license file version [CI SKIP]

This commit is contained in:
2023-03-15 12:34:41 +00:00
parent 0a6d92a1f3
commit 61328d20ed
13115 changed files with 1892314 additions and 1 deletions

View File

@@ -0,0 +1,43 @@
# for-each [![build status][1]][2]
[![browser support][3]][4]
A better forEach.
## Example
Like `Array.prototype.forEach` but works on objects.
```js
var forEach = require("for-each")
forEach({ key: "value" }, function (value, key, object) {
/* code */
})
```
As a bonus, it's also a perfectly function shim/polyfill for arrays too!
```js
var forEach = require("for-each")
forEach([1, 2, 3], function (value, index, array) {
/* code */
})
```
## Installation
`npm install for-each`
## Contributors
- Raynos
## MIT Licenced
[1]: https://secure.travis-ci.org/Raynos/for-each.png
[2]: http://travis-ci.org/Raynos/for-each
[3]: https://ci.testling.com/Raynos/for-each.png
[4]: https://ci.testling.com/Raynos/for-each

View File

@@ -0,0 +1,29 @@
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;

View File

@@ -0,0 +1,160 @@
import { WebSocketSubject, WebSocketSubjectConfig } from './WebSocketSubject';
/**
* Wrapper around the w3c-compatible WebSocket object provided by the browser.
*
* <span class="informal">{@link Subject} that communicates with a server via WebSocket</span>
*
* `webSocket` is a factory function that produces a `WebSocketSubject`,
* which can be used to make WebSocket connection with an arbitrary endpoint.
* `webSocket` accepts as an argument either a string with url of WebSocket endpoint, or an
* {@link WebSocketSubjectConfig} object for providing additional configuration, as
* well as Observers for tracking lifecycle of WebSocket connection.
*
* When `WebSocketSubject` is subscribed, it attempts to make a socket connection,
* unless there is one made already. This means that many subscribers will always listen
* on the same socket, thus saving resources. If however, two instances are made of `WebSocketSubject`,
* even if these two were provided with the same url, they will attempt to make separate
* connections. When consumer of a `WebSocketSubject` unsubscribes, socket connection is closed,
* only if there are no more subscribers still listening. If after some time a consumer starts
* subscribing again, connection is reestablished.
*
* Once connection is made, whenever a new message comes from the server, `WebSocketSubject` will emit that
* message as a value in the stream. By default, a message from the socket is parsed via `JSON.parse`. If you
* want to customize how deserialization is handled (if at all), you can provide custom `resultSelector`
* function in {@link WebSocketSubject}. When connection closes, stream will complete, provided it happened without
* any errors. If at any point (starting, maintaining or closing a connection) there is an error,
* stream will also error with whatever WebSocket API has thrown.
*
* By virtue of being a {@link Subject}, `WebSocketSubject` allows for receiving and sending messages from the server. In order
* to communicate with a connected endpoint, use `next`, `error` and `complete` methods. `next` sends a value to the server, so bear in mind
* that this value will not be serialized beforehand. Because of This, `JSON.stringify` will have to be called on a value by hand,
* before calling `next` with a result. Note also that if at the moment of nexting value
* there is no socket connection (for example no one is subscribing), those values will be buffered, and sent when connection
* is finally established. `complete` method closes socket connection. `error` does the same,
* as well as notifying the server that something went wrong via status code and string with details of what happened.
* Since status code is required in WebSocket API, `WebSocketSubject` does not allow, like regular `Subject`,
* arbitrary values being passed to the `error` method. It needs to be called with an object that has `code`
* property with status code number and optional `reason` property with string describing details
* of an error.
*
* Calling `next` does not affect subscribers of `WebSocketSubject` - they have no
* information that something was sent to the server (unless of course the server
* responds somehow to a message). On the other hand, since calling `complete` triggers
* an attempt to close socket connection. If that connection is closed without any errors, stream will
* complete, thus notifying all subscribers. And since calling `error` closes
* socket connection as well, just with a different status code for the server, if closing itself proceeds
* without errors, subscribed Observable will not error, as one might expect, but complete as usual. In both cases
* (calling `complete` or `error`), if process of closing socket connection results in some errors, *then* stream
* will error.
*
* **Multiplexing**
*
* `WebSocketSubject` has an additional operator, not found in other Subjects. It is called `multiplex` and it is
* used to simulate opening several socket connections, while in reality maintaining only one.
* For example, an application has both chat panel and real-time notifications about sport news. Since these are two distinct functions,
* it would make sense to have two separate connections for each. Perhaps there could even be two separate services with WebSocket
* endpoints, running on separate machines with only GUI combining them together. Having a socket connection
* for each functionality could become too resource expensive. It is a common pattern to have single
* WebSocket endpoint that acts as a gateway for the other services (in this case chat and sport news services).
* Even though there is a single connection in a client app, having the ability to manipulate streams as if it
* were two separate sockets is desirable. This eliminates manually registering and unregistering in a gateway for
* given service and filter out messages of interest. This is exactly what `multiplex` method is for.
*
* Method accepts three parameters. First two are functions returning subscription and unsubscription messages
* respectively. These are messages that will be sent to the server, whenever consumer of resulting Observable
* subscribes and unsubscribes. Server can use them to verify that some kind of messages should start or stop
* being forwarded to the client. In case of the above example application, after getting subscription message with proper identifier,
* gateway server can decide that it should connect to real sport news service and start forwarding messages from it.
* Note that both messages will be sent as returned by the functions, they are by default serialized using JSON.stringify, just
* as messages pushed via `next`. Also bear in mind that these messages will be sent on *every* subscription and
* unsubscription. This is potentially dangerous, because one consumer of an Observable may unsubscribe and the server
* might stop sending messages, since it got unsubscription message. This needs to be handled
* on the server or using {@link publish} on a Observable returned from 'multiplex'.
*
* Last argument to `multiplex` is a `messageFilter` function which should return a boolean. It is used to filter out messages
* sent by the server to only those that belong to simulated WebSocket stream. For example, server might mark these
* messages with some kind of string identifier on a message object and `messageFilter` would return `true`
* if there is such identifier on an object emitted by the socket. Messages which returns `false` in `messageFilter` are simply skipped,
* and are not passed down the stream.
*
* Return value of `multiplex` is an Observable with messages incoming from emulated socket connection. Note that this
* is not a `WebSocketSubject`, so calling `next` or `multiplex` again will fail. For pushing values to the
* server, use root `WebSocketSubject`.
*
* ## Examples
*
* Listening for messages from the server
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const subject = webSocket('ws://localhost:8081');
*
* subject.subscribe({
* next: msg => console.log('message received: ' + msg), // Called whenever there is a message from the server.
* error: err => console.log(err), // Called if at any point WebSocket API signals some kind of error.
* complete: () => console.log('complete') // Called when connection is closed (for whatever reason).
* });
* ```
*
* Pushing messages to the server
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const subject = webSocket('ws://localhost:8081');
*
* subject.subscribe();
* // Note that at least one consumer has to subscribe to the created subject - otherwise "nexted" values will be just buffered and not sent,
* // since no connection was established!
*
* subject.next({ message: 'some message' });
* // This will send a message to the server once a connection is made. Remember value is serialized with JSON.stringify by default!
*
* subject.complete(); // Closes the connection.
*
* subject.error({ code: 4000, reason: 'I think our app just broke!' });
* // Also closes the connection, but let's the server know that this closing is caused by some error.
* ```
*
* Multiplexing WebSocket
*
* ```ts
* import { webSocket } from 'rxjs/webSocket';
*
* const subject = webSocket('ws://localhost:8081');
*
* const observableA = subject.multiplex(
* () => ({ subscribe: 'A' }), // When server gets this message, it will start sending messages for 'A'...
* () => ({ unsubscribe: 'A' }), // ...and when gets this one, it will stop.
* message => message.type === 'A' // If the function returns `true` message is passed down the stream. Skipped if the function returns false.
* );
*
* const observableB = subject.multiplex( // And the same goes for 'B'.
* () => ({ subscribe: 'B' }),
* () => ({ unsubscribe: 'B' }),
* message => message.type === 'B'
* );
*
* const subA = observableA.subscribe(messageForA => console.log(messageForA));
* // At this moment WebSocket connection is established. Server gets '{"subscribe": "A"}' message and starts sending messages for 'A',
* // which we log here.
*
* const subB = observableB.subscribe(messageForB => console.log(messageForB));
* // Since we already have a connection, we just send '{"subscribe": "B"}' message to the server. It starts sending messages for 'B',
* // which we log here.
*
* subB.unsubscribe();
* // Message '{"unsubscribe": "B"}' is sent to the server, which stops sending 'B' messages.
*
* subA.unsubscribe();
* // Message '{"unsubscribe": "A"}' makes the server stop sending messages for 'A'. Since there is no more subscribers to root Subject,
* // socket connection closes.
* ```
*
* @param {string|WebSocketSubjectConfig} urlConfigOrSource The WebSocket endpoint as an url or an object with
* configuration and additional Observers.
* @return {WebSocketSubject} Subject which allows to both send and receive messages via WebSocket connection.
*/
export declare function webSocket<T>(urlConfigOrSource: string | WebSocketSubjectConfig<T>): WebSocketSubject<T>;
//# sourceMappingURL=webSocket.d.ts.map

View File

@@ -0,0 +1,52 @@
const SemVer = require('../classes/semver')
const parse = require('./parse')
const { re, t } = require('../internal/re')
const coerce = (version, options) => {
if (version instanceof SemVer) {
return version
}
if (typeof version === 'number') {
version = String(version)
}
if (typeof version !== 'string') {
return null
}
options = options || {}
let match = null
if (!options.rtl) {
match = version.match(re[t.COERCE])
} else {
// Find the right-most coercible string that does not share
// a terminus with a more left-ward coercible string.
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
//
// Walk through the string checking with a /g regexp
// Manually set the index so as to pick up overlapping matches.
// Stop when we get a match that ends at the string end, since no
// coercible string can be more right-ward without the same terminus.
let next
while ((next = re[t.COERCERTL].exec(version)) &&
(!match || match.index + match[0].length !== version.length)
) {
if (!match ||
next.index + next[0].length !== match.index + match[0].length) {
match = next
}
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
}
// leave it in a clean state
re[t.COERCERTL].lastIndex = -1
}
if (match === null) {
return null
}
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
}
module.exports = coerce

View File

@@ -0,0 +1,18 @@
var arrayMap = require('./_arrayMap');
/**
* The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
* of key-value pairs for `object` corresponding to the property names of `props`.
*
* @private
* @param {Object} object The object to query.
* @param {Array} props The property names to get values for.
* @returns {Object} Returns the key-value pairs.
*/
function baseToPairs(object, props) {
return arrayMap(props, function(key) {
return [key, object[key]];
});
}
module.exports = baseToPairs;

View File

@@ -0,0 +1,8 @@
"use strict";
var isDate = require("./is-date");
module.exports = function (value) {
if (!isDate(value)) throw new TypeError(value + " is not valid Date object");
return value;
};

View File

@@ -0,0 +1,44 @@
{
"name": "@nodelib/fs.walk",
"version": "1.2.8",
"description": "A library for efficiently walking a directory recursively",
"license": "MIT",
"repository": "https://github.com/nodelib/nodelib/tree/master/packages/fs/fs.walk",
"keywords": [
"NodeLib",
"fs",
"FileSystem",
"file system",
"walk",
"scanner",
"crawler"
],
"engines": {
"node": ">= 8"
},
"files": [
"out/**",
"!out/**/*.map",
"!out/**/*.spec.*",
"!out/**/tests/**"
],
"main": "out/index.js",
"typings": "out/index.d.ts",
"scripts": {
"clean": "rimraf {tsconfig.tsbuildinfo,out}",
"lint": "eslint \"src/**/*.ts\" --cache",
"compile": "tsc -b .",
"compile:watch": "tsc -p . --watch --sourceMap",
"test": "mocha \"out/**/*.spec.js\" -s 0",
"build": "npm run clean && npm run compile && npm run lint && npm test",
"watch": "npm run clean && npm run compile:watch"
},
"dependencies": {
"@nodelib/fs.scandir": "2.1.5",
"fastq": "^1.6.0"
},
"devDependencies": {
"@nodelib/fs.macchiato": "1.0.4"
},
"gitHead": "1e5bad48565da2b06b8600e744324ea240bf49d8"
}

View File

@@ -0,0 +1,44 @@
import { AsyncAction } from './AsyncAction';
import { Subscription } from '../Subscription';
import { QueueScheduler } from './QueueScheduler';
import { SchedulerAction } from '../types';
import { TimerHandle } from './timerHandle';
export class QueueAction<T> extends AsyncAction<T> {
constructor(protected scheduler: QueueScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}
public schedule(state?: T, delay: number = 0): Subscription {
if (delay > 0) {
return super.schedule(state, delay);
}
this.delay = delay;
this.state = state;
this.scheduler.flush(this);
return this;
}
public execute(state: T, delay: number): any {
return delay > 0 || this.closed ? super.execute(state, delay) : this._execute(state, delay);
}
protected requestAsyncId(scheduler: QueueScheduler, id?: TimerHandle, delay: number = 0): TimerHandle {
// If delay exists and is greater than 0, or if the delay is null (the
// action wasn't rescheduled) but was originally scheduled as an async
// action, then recycle as an async action.
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) {
return super.requestAsyncId(scheduler, id, delay);
}
// Otherwise flush the scheduler starting with this action.
scheduler.flush(this);
// HACK: In the past, this was returning `void`. However, `void` isn't a valid
// `TimerHandle`, and generally the return value here isn't really used. So the
// compromise is to return `0` which is both "falsy" and a valid `TimerHandle`,
// as opposed to refactoring every other instanceo of `requestAsyncId`.
return 0;
}
}

View File

@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('minBy', require('../minBy'));
func.placeholder = require('./placeholder');
module.exports = func;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"16":"J D CC","132":"E F A B"},B:{"132":"C K L G M N O","322":"P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H"},C:{"2":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB EC FC","1025":"VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","1602":"UB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB","322":"JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"2":"0 1 2 3 4 5 F B C G M N O w g x y z PC QC RC SC qB AC TC rB","322":"6 7 8 9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e"},G:{"2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"2":"tB I pC qC rC sC BC tC uC","322":"f"},J:{"2":"D A"},K:{"2":"A B C qB AC rB","322":"h"},L:{"322":"H"},M:{"1025":"H"},N:{"132":"A B"},O:{"322":"vC"},P:{"2":"I","322":"g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"322":"1B"},R:{"322":"9C"},S:{"2":"AD","1025":"BD"}},B:4,C:"CSS text-justify"};

View File

@@ -0,0 +1 @@
{"name":"unpipe","version":"1.0.0","files":{"package.json":{"checkedAt":1678883672334,"integrity":"sha512-ZzRHwaQCL35G06GFex20gcO2HE+TYVbkIumbTvLjW82Eh6Sw91M5AKOwcf50dePRFzKj3wf5ljg6BPUIzpA66A==","mode":438,"size":770},"README.md":{"checkedAt":1678883672334,"integrity":"sha512-SIPuSjpXdskBeWChy+mA3xSB9xB9bkHzZzMo2t+oKAOzlZdRXj8S1DgraJeNIHzihPhzMMT3ZAWqL3pzVAMfyw==","mode":438,"size":1250},"index.js":{"checkedAt":1678883672334,"integrity":"sha512-v+wKJSyNJxjGt0fkDm06zxZcX3l/cl5HKeR3cHqqBPaQThsAaI3TSMol/hOt744/x/D8iwOHc1m1iDIkEH3A3g==","mode":438,"size":1118},"LICENSE":{"checkedAt":1678883672334,"integrity":"sha512-59MbDWmlhxDb6EpZv8FXSWCbzU3wE/9wDePK6gsGaVYukFVX9jtL90WZfdiFlFegNmj39faZ758AdVVe5PGGSw==","mode":438,"size":1114},"HISTORY.md":{"checkedAt":1678883672334,"integrity":"sha512-lEV2rWEF6452fUK1x6yaPma5tzm3q1h8K87X0QyTUZis6xbvoBuCl/f+fltZgwBNEI8YGV0tV42212U6pdI7zg==","mode":438,"size":59}}}

View File

@@ -0,0 +1,44 @@
import { Subscription } from '../Subscription';
import { SchedulerAction, SchedulerLike } from '../types';
export function executeSchedule(
parentSubscription: Subscription,
scheduler: SchedulerLike,
work: () => void,
delay: number,
repeat: true
): void;
export function executeSchedule(
parentSubscription: Subscription,
scheduler: SchedulerLike,
work: () => void,
delay?: number,
repeat?: false
): Subscription;
export function executeSchedule(
parentSubscription: Subscription,
scheduler: SchedulerLike,
work: () => void,
delay = 0,
repeat = false
): Subscription | void {
const scheduleSubscription = scheduler.schedule(function (this: SchedulerAction<any>) {
work();
if (repeat) {
parentSubscription.add(this.schedule(null, delay));
} else {
this.unsubscribe();
}
}, delay);
parentSubscription.add(scheduleSubscription);
if (!repeat) {
// Because user-land scheduler implementations are unlikely to properly reuse
// Actions for repeat scheduling, we can't trust that the returned subscription
// will control repeat subscription scenarios. So we're trying to avoid using them
// incorrectly within this library.
return scheduleSubscription;
}
}

View File

@@ -0,0 +1,69 @@
import { ObservableInput, OperatorFunction } from '../types';
/**
* Applies an accumulator function over the source Observable where the
* accumulator function itself returns an Observable, then each intermediate
* Observable returned is merged into the output Observable.
*
* <span class="informal">It's like {@link scan}, but the Observables returned
* by the accumulator are merged into the outer Observable.</span>
*
* The first parameter of the `mergeScan` is an `accumulator` function which is
* being called every time the source Observable emits a value. `mergeScan` will
* subscribe to the value returned by the `accumulator` function and will emit
* values to the subscriber emitted by inner Observable.
*
* The `accumulator` function is being called with three parameters passed to it:
* `acc`, `value` and `index`. The `acc` parameter is used as the state parameter
* whose value is initially set to the `seed` parameter (the second parameter
* passed to the `mergeScan` operator).
*
* `mergeScan` internally keeps the value of the `acc` parameter: as long as the
* source Observable emits without inner Observable emitting, the `acc` will be
* set to `seed`. The next time the inner Observable emits a value, `mergeScan`
* will internally remember it and it will be passed to the `accumulator`
* function as `acc` parameter the next time source emits.
*
* The `value` parameter of the `accumulator` function is the value emitted by the
* source Observable, while the `index` is a number which represent the order of the
* current emission by the source Observable. It starts with 0.
*
* The last parameter to the `mergeScan` is the `concurrent` value which defaults
* to Infinity. It represents the maximum number of inner Observable subscriptions
* at a time.
*
* ## Example
*
* Count the number of click events
*
* ```ts
* import { fromEvent, map, mergeScan, of } from 'rxjs';
*
* const click$ = fromEvent(document, 'click');
* const one$ = click$.pipe(map(() => 1));
* const seed = 0;
* const count$ = one$.pipe(
* mergeScan((acc, one) => of(acc + one), seed)
* );
*
* count$.subscribe(x => console.log(x));
*
* // Results:
* // 1
* // 2
* // 3
* // 4
* // ...and so on for each click
* ```
*
* @see {@link scan}
* @see {@link switchScan}
*
* @param {function(acc: R, value: T): Observable<R>} accumulator
* The accumulator function called on each source value.
* @param seed The initial accumulation value.
* @param {number} [concurrent=Infinity] Maximum number of
* input Observables being subscribed to concurrently.
* @return A function that returns an Observable of the accumulated values.
*/
export declare function mergeScan<T, R>(accumulator: (acc: R, value: T, index: number) => ObservableInput<R>, seed: R, concurrent?: number): OperatorFunction<T, R>;
//# sourceMappingURL=mergeScan.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"sha1.js","sourceRoot":"","sources":["../src/sha1.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,qCAAqC;AACrC,2EAA2E;AAE3E,WAAW;AACX,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,KAAa,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAChG,oBAAoB;AACpB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AACpE,oDAAoD;AACpD,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAE7E,gBAAgB;AAChB,MAAM,EAAE,GAAG,IAAI,WAAW,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzF,4DAA4D;AAC5D,mDAAmD;AACnD,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,EAAE,CAAC,CAAC;AACnC,MAAM,IAAK,SAAQ,IAAU;IAO3B;QACE,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAPlB,MAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACd,MAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACd,MAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACd,MAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACd,MAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAItB,CAAC;IACS,GAAG;QACX,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QAC/B,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACzB,CAAC;IACS,GAAG,CAAC,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS;QACjE,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IACS,OAAO,CAAC,IAAc,EAAE,MAAc;QAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,CAAC;YAAE,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACpF,KAAK,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE;YAC1B,MAAM,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACvF,4CAA4C;QAC5C,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;YAC3B,IAAI,CAAC,EAAE,CAAC,CAAC;YACT,IAAI,CAAC,GAAG,EAAE,EAAE;gBACV,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBACjB,CAAC,GAAG,UAAU,CAAC;aAChB;iBAAM,IAAI,CAAC,GAAG,EAAE,EAAE;gBACjB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC,GAAG,UAAU,CAAC;aAChB;iBAAM,IAAI,CAAC,GAAG,EAAE,EAAE;gBACjB,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;gBACjB,CAAC,GAAG,UAAU,CAAC;aAChB;iBAAM;gBACL,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACd,CAAC,GAAG,UAAU,CAAC;aAChB;YACD,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACnD,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAChB,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;SACP;QACD,qDAAqD;QACrD,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IACS,UAAU;QAClB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;IACD,OAAO;QACL,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC"}

View File

@@ -0,0 +1,51 @@
export type Difference =
| 'major'
| 'premajor'
| 'minor'
| 'preminor'
| 'patch'
| 'prepatch'
| 'prerelease'
| 'build';
/**
Get the diff type of two [semver](https://github.com/npm/node-semver) versions: `0.0.1 0.0.2` → `patch`.
@returns The difference type between two semver versions, or `undefined` if they are identical or the second one is lower than the first.
@example
```
import semverDiff from 'semver-diff';
semverDiff('1.1.1', '1.1.2');
//=> 'patch'
semverDiff('1.1.1-foo', '1.1.2');
//=> 'prepatch'
semverDiff('0.0.1', '1.0.0');
//=> 'major'
semverDiff('0.0.1-foo', '1.0.0');
//=> 'premajor'
semverDiff('0.0.1', '0.1.0');
//=> 'minor'
semverDiff('0.0.1-foo', '0.1.0');
//=> 'preminor'
semverDiff('0.0.1-foo', '0.0.1-foo.bar');
//=> 'prerelease'
semverDiff('0.1.0', '0.1.0+foo');
//=> 'build'
semverDiff('0.0.1', '0.0.1');
//=> undefined
semverDiff('0.0.2', '0.0.1');
//=> undefined
```
*/
export default function semverDiff(versionA: string, versionB: string): Difference | undefined;

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J D E F A B CC"},B:{"2":"C K L G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q","194":"r s t u f H"},C:{"1":"PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB","2":"DC tB I v J D E F A B C K L G M EC FC","33":"0 1 2 3 4 5 6 7 8 9 N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB"},D:{"2":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z","194":"a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"9B OC","2":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B"},F:{"2":"0 1 2 3 4 5 6 7 8 9 F B C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z PC QC RC SC qB AC TC rB","194":"a b c d e"},G:{"1":"9B","2":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B"},H:{"2":"oC"},I:{"2":"tB I f pC qC rC sC BC tC uC"},J:{"2":"D A"},K:{"2":"A B C h qB AC rB"},L:{"2":"H"},M:{"1":"H"},N:{"2":"A B"},O:{"2":"vC"},P:{"2":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"2":"1B"},R:{"2":"9C"},S:{"1":"BD","33":"AD"}},B:5,C:":dir() CSS pseudo-class"};

View File

@@ -0,0 +1,618 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TestScheduler = void 0;
var Observable_1 = require("../Observable");
var ColdObservable_1 = require("./ColdObservable");
var HotObservable_1 = require("./HotObservable");
var SubscriptionLog_1 = require("./SubscriptionLog");
var VirtualTimeScheduler_1 = require("../scheduler/VirtualTimeScheduler");
var NotificationFactories_1 = require("../NotificationFactories");
var dateTimestampProvider_1 = require("../scheduler/dateTimestampProvider");
var performanceTimestampProvider_1 = require("../scheduler/performanceTimestampProvider");
var animationFrameProvider_1 = require("../scheduler/animationFrameProvider");
var immediateProvider_1 = require("../scheduler/immediateProvider");
var intervalProvider_1 = require("../scheduler/intervalProvider");
var timeoutProvider_1 = require("../scheduler/timeoutProvider");
var defaultMaxFrame = 750;
var TestScheduler = (function (_super) {
__extends(TestScheduler, _super);
function TestScheduler(assertDeepEqual) {
var _this = _super.call(this, VirtualTimeScheduler_1.VirtualAction, defaultMaxFrame) || this;
_this.assertDeepEqual = assertDeepEqual;
_this.hotObservables = [];
_this.coldObservables = [];
_this.flushTests = [];
_this.runMode = false;
return _this;
}
TestScheduler.prototype.createTime = function (marbles) {
var indexOf = this.runMode ? marbles.trim().indexOf('|') : marbles.indexOf('|');
if (indexOf === -1) {
throw new Error('marble diagram for time should have a completion marker "|"');
}
return indexOf * TestScheduler.frameTimeFactor;
};
TestScheduler.prototype.createColdObservable = function (marbles, values, error) {
if (marbles.indexOf('^') !== -1) {
throw new Error('cold observable cannot have subscription offset "^"');
}
if (marbles.indexOf('!') !== -1) {
throw new Error('cold observable cannot have unsubscription marker "!"');
}
var messages = TestScheduler.parseMarbles(marbles, values, error, undefined, this.runMode);
var cold = new ColdObservable_1.ColdObservable(messages, this);
this.coldObservables.push(cold);
return cold;
};
TestScheduler.prototype.createHotObservable = function (marbles, values, error) {
if (marbles.indexOf('!') !== -1) {
throw new Error('hot observable cannot have unsubscription marker "!"');
}
var messages = TestScheduler.parseMarbles(marbles, values, error, undefined, this.runMode);
var subject = new HotObservable_1.HotObservable(messages, this);
this.hotObservables.push(subject);
return subject;
};
TestScheduler.prototype.materializeInnerObservable = function (observable, outerFrame) {
var _this = this;
var messages = [];
observable.subscribe({
next: function (value) {
messages.push({ frame: _this.frame - outerFrame, notification: NotificationFactories_1.nextNotification(value) });
},
error: function (error) {
messages.push({ frame: _this.frame - outerFrame, notification: NotificationFactories_1.errorNotification(error) });
},
complete: function () {
messages.push({ frame: _this.frame - outerFrame, notification: NotificationFactories_1.COMPLETE_NOTIFICATION });
},
});
return messages;
};
TestScheduler.prototype.expectObservable = function (observable, subscriptionMarbles) {
var _this = this;
if (subscriptionMarbles === void 0) { subscriptionMarbles = null; }
var actual = [];
var flushTest = { actual: actual, ready: false };
var subscriptionParsed = TestScheduler.parseMarblesAsSubscriptions(subscriptionMarbles, this.runMode);
var subscriptionFrame = subscriptionParsed.subscribedFrame === Infinity ? 0 : subscriptionParsed.subscribedFrame;
var unsubscriptionFrame = subscriptionParsed.unsubscribedFrame;
var subscription;
this.schedule(function () {
subscription = observable.subscribe({
next: function (x) {
var value = x instanceof Observable_1.Observable ? _this.materializeInnerObservable(x, _this.frame) : x;
actual.push({ frame: _this.frame, notification: NotificationFactories_1.nextNotification(value) });
},
error: function (error) {
actual.push({ frame: _this.frame, notification: NotificationFactories_1.errorNotification(error) });
},
complete: function () {
actual.push({ frame: _this.frame, notification: NotificationFactories_1.COMPLETE_NOTIFICATION });
},
});
}, subscriptionFrame);
if (unsubscriptionFrame !== Infinity) {
this.schedule(function () { return subscription.unsubscribe(); }, unsubscriptionFrame);
}
this.flushTests.push(flushTest);
var runMode = this.runMode;
return {
toBe: function (marbles, values, errorValue) {
flushTest.ready = true;
flushTest.expected = TestScheduler.parseMarbles(marbles, values, errorValue, true, runMode);
},
toEqual: function (other) {
flushTest.ready = true;
flushTest.expected = [];
_this.schedule(function () {
subscription = other.subscribe({
next: function (x) {
var value = x instanceof Observable_1.Observable ? _this.materializeInnerObservable(x, _this.frame) : x;
flushTest.expected.push({ frame: _this.frame, notification: NotificationFactories_1.nextNotification(value) });
},
error: function (error) {
flushTest.expected.push({ frame: _this.frame, notification: NotificationFactories_1.errorNotification(error) });
},
complete: function () {
flushTest.expected.push({ frame: _this.frame, notification: NotificationFactories_1.COMPLETE_NOTIFICATION });
},
});
}, subscriptionFrame);
},
};
};
TestScheduler.prototype.expectSubscriptions = function (actualSubscriptionLogs) {
var flushTest = { actual: actualSubscriptionLogs, ready: false };
this.flushTests.push(flushTest);
var runMode = this.runMode;
return {
toBe: function (marblesOrMarblesArray) {
var marblesArray = typeof marblesOrMarblesArray === 'string' ? [marblesOrMarblesArray] : marblesOrMarblesArray;
flushTest.ready = true;
flushTest.expected = marblesArray
.map(function (marbles) { return TestScheduler.parseMarblesAsSubscriptions(marbles, runMode); })
.filter(function (marbles) { return marbles.subscribedFrame !== Infinity; });
},
};
};
TestScheduler.prototype.flush = function () {
var _this = this;
var hotObservables = this.hotObservables;
while (hotObservables.length > 0) {
hotObservables.shift().setup();
}
_super.prototype.flush.call(this);
this.flushTests = this.flushTests.filter(function (test) {
if (test.ready) {
_this.assertDeepEqual(test.actual, test.expected);
return false;
}
return true;
});
};
TestScheduler.parseMarblesAsSubscriptions = function (marbles, runMode) {
var _this = this;
if (runMode === void 0) { runMode = false; }
if (typeof marbles !== 'string') {
return new SubscriptionLog_1.SubscriptionLog(Infinity);
}
var characters = __spreadArray([], __read(marbles));
var len = characters.length;
var groupStart = -1;
var subscriptionFrame = Infinity;
var unsubscriptionFrame = Infinity;
var frame = 0;
var _loop_1 = function (i) {
var nextFrame = frame;
var advanceFrameBy = function (count) {
nextFrame += count * _this.frameTimeFactor;
};
var c = characters[i];
switch (c) {
case ' ':
if (!runMode) {
advanceFrameBy(1);
}
break;
case '-':
advanceFrameBy(1);
break;
case '(':
groupStart = frame;
advanceFrameBy(1);
break;
case ')':
groupStart = -1;
advanceFrameBy(1);
break;
case '^':
if (subscriptionFrame !== Infinity) {
throw new Error("found a second subscription point '^' in a " + 'subscription marble diagram. There can only be one.');
}
subscriptionFrame = groupStart > -1 ? groupStart : frame;
advanceFrameBy(1);
break;
case '!':
if (unsubscriptionFrame !== Infinity) {
throw new Error("found a second unsubscription point '!' in a " + 'subscription marble diagram. There can only be one.');
}
unsubscriptionFrame = groupStart > -1 ? groupStart : frame;
break;
default:
if (runMode && c.match(/^[0-9]$/)) {
if (i === 0 || characters[i - 1] === ' ') {
var buffer = characters.slice(i).join('');
var match = buffer.match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);
if (match) {
i += match[0].length - 1;
var duration = parseFloat(match[1]);
var unit = match[2];
var durationInMs = void 0;
switch (unit) {
case 'ms':
durationInMs = duration;
break;
case 's':
durationInMs = duration * 1000;
break;
case 'm':
durationInMs = duration * 1000 * 60;
break;
default:
break;
}
advanceFrameBy(durationInMs / this_1.frameTimeFactor);
break;
}
}
}
throw new Error("there can only be '^' and '!' markers in a " + "subscription marble diagram. Found instead '" + c + "'.");
}
frame = nextFrame;
out_i_1 = i;
};
var this_1 = this, out_i_1;
for (var i = 0; i < len; i++) {
_loop_1(i);
i = out_i_1;
}
if (unsubscriptionFrame < 0) {
return new SubscriptionLog_1.SubscriptionLog(subscriptionFrame);
}
else {
return new SubscriptionLog_1.SubscriptionLog(subscriptionFrame, unsubscriptionFrame);
}
};
TestScheduler.parseMarbles = function (marbles, values, errorValue, materializeInnerObservables, runMode) {
var _this = this;
if (materializeInnerObservables === void 0) { materializeInnerObservables = false; }
if (runMode === void 0) { runMode = false; }
if (marbles.indexOf('!') !== -1) {
throw new Error('conventional marble diagrams cannot have the ' + 'unsubscription marker "!"');
}
var characters = __spreadArray([], __read(marbles));
var len = characters.length;
var testMessages = [];
var subIndex = runMode ? marbles.replace(/^[ ]+/, '').indexOf('^') : marbles.indexOf('^');
var frame = subIndex === -1 ? 0 : subIndex * -this.frameTimeFactor;
var getValue = typeof values !== 'object'
? function (x) { return x; }
: function (x) {
if (materializeInnerObservables && values[x] instanceof ColdObservable_1.ColdObservable) {
return values[x].messages;
}
return values[x];
};
var groupStart = -1;
var _loop_2 = function (i) {
var nextFrame = frame;
var advanceFrameBy = function (count) {
nextFrame += count * _this.frameTimeFactor;
};
var notification = void 0;
var c = characters[i];
switch (c) {
case ' ':
if (!runMode) {
advanceFrameBy(1);
}
break;
case '-':
advanceFrameBy(1);
break;
case '(':
groupStart = frame;
advanceFrameBy(1);
break;
case ')':
groupStart = -1;
advanceFrameBy(1);
break;
case '|':
notification = NotificationFactories_1.COMPLETE_NOTIFICATION;
advanceFrameBy(1);
break;
case '^':
advanceFrameBy(1);
break;
case '#':
notification = NotificationFactories_1.errorNotification(errorValue || 'error');
advanceFrameBy(1);
break;
default:
if (runMode && c.match(/^[0-9]$/)) {
if (i === 0 || characters[i - 1] === ' ') {
var buffer = characters.slice(i).join('');
var match = buffer.match(/^([0-9]+(?:\.[0-9]+)?)(ms|s|m) /);
if (match) {
i += match[0].length - 1;
var duration = parseFloat(match[1]);
var unit = match[2];
var durationInMs = void 0;
switch (unit) {
case 'ms':
durationInMs = duration;
break;
case 's':
durationInMs = duration * 1000;
break;
case 'm':
durationInMs = duration * 1000 * 60;
break;
default:
break;
}
advanceFrameBy(durationInMs / this_2.frameTimeFactor);
break;
}
}
}
notification = NotificationFactories_1.nextNotification(getValue(c));
advanceFrameBy(1);
break;
}
if (notification) {
testMessages.push({ frame: groupStart > -1 ? groupStart : frame, notification: notification });
}
frame = nextFrame;
out_i_2 = i;
};
var this_2 = this, out_i_2;
for (var i = 0; i < len; i++) {
_loop_2(i);
i = out_i_2;
}
return testMessages;
};
TestScheduler.prototype.createAnimator = function () {
var _this = this;
if (!this.runMode) {
throw new Error('animate() must only be used in run mode');
}
var lastHandle = 0;
var map;
var delegate = {
requestAnimationFrame: function (callback) {
if (!map) {
throw new Error('animate() was not called within run()');
}
var handle = ++lastHandle;
map.set(handle, callback);
return handle;
},
cancelAnimationFrame: function (handle) {
if (!map) {
throw new Error('animate() was not called within run()');
}
map.delete(handle);
},
};
var animate = function (marbles) {
var e_1, _a;
if (map) {
throw new Error('animate() must not be called more than once within run()');
}
if (/[|#]/.test(marbles)) {
throw new Error('animate() must not complete or error');
}
map = new Map();
var messages = TestScheduler.parseMarbles(marbles, undefined, undefined, undefined, true);
try {
for (var messages_1 = __values(messages), messages_1_1 = messages_1.next(); !messages_1_1.done; messages_1_1 = messages_1.next()) {
var message = messages_1_1.value;
_this.schedule(function () {
var e_2, _a;
var now = _this.now();
var callbacks = Array.from(map.values());
map.clear();
try {
for (var callbacks_1 = (e_2 = void 0, __values(callbacks)), callbacks_1_1 = callbacks_1.next(); !callbacks_1_1.done; callbacks_1_1 = callbacks_1.next()) {
var callback = callbacks_1_1.value;
callback(now);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (callbacks_1_1 && !callbacks_1_1.done && (_a = callbacks_1.return)) _a.call(callbacks_1);
}
finally { if (e_2) throw e_2.error; }
}
}, message.frame);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (messages_1_1 && !messages_1_1.done && (_a = messages_1.return)) _a.call(messages_1);
}
finally { if (e_1) throw e_1.error; }
}
};
return { animate: animate, delegate: delegate };
};
TestScheduler.prototype.createDelegates = function () {
var _this = this;
var lastHandle = 0;
var scheduleLookup = new Map();
var run = function () {
var now = _this.now();
var scheduledRecords = Array.from(scheduleLookup.values());
var scheduledRecordsDue = scheduledRecords.filter(function (_a) {
var due = _a.due;
return due <= now;
});
var dueImmediates = scheduledRecordsDue.filter(function (_a) {
var type = _a.type;
return type === 'immediate';
});
if (dueImmediates.length > 0) {
var _a = dueImmediates[0], handle = _a.handle, handler = _a.handler;
scheduleLookup.delete(handle);
handler();
return;
}
var dueIntervals = scheduledRecordsDue.filter(function (_a) {
var type = _a.type;
return type === 'interval';
});
if (dueIntervals.length > 0) {
var firstDueInterval = dueIntervals[0];
var duration = firstDueInterval.duration, handler = firstDueInterval.handler;
firstDueInterval.due = now + duration;
firstDueInterval.subscription = _this.schedule(run, duration);
handler();
return;
}
var dueTimeouts = scheduledRecordsDue.filter(function (_a) {
var type = _a.type;
return type === 'timeout';
});
if (dueTimeouts.length > 0) {
var _b = dueTimeouts[0], handle = _b.handle, handler = _b.handler;
scheduleLookup.delete(handle);
handler();
return;
}
throw new Error('Expected a due immediate or interval');
};
var immediate = {
setImmediate: function (handler) {
var handle = ++lastHandle;
scheduleLookup.set(handle, {
due: _this.now(),
duration: 0,
handle: handle,
handler: handler,
subscription: _this.schedule(run, 0),
type: 'immediate',
});
return handle;
},
clearImmediate: function (handle) {
var value = scheduleLookup.get(handle);
if (value) {
value.subscription.unsubscribe();
scheduleLookup.delete(handle);
}
},
};
var interval = {
setInterval: function (handler, duration) {
if (duration === void 0) { duration = 0; }
var handle = ++lastHandle;
scheduleLookup.set(handle, {
due: _this.now() + duration,
duration: duration,
handle: handle,
handler: handler,
subscription: _this.schedule(run, duration),
type: 'interval',
});
return handle;
},
clearInterval: function (handle) {
var value = scheduleLookup.get(handle);
if (value) {
value.subscription.unsubscribe();
scheduleLookup.delete(handle);
}
},
};
var timeout = {
setTimeout: function (handler, duration) {
if (duration === void 0) { duration = 0; }
var handle = ++lastHandle;
scheduleLookup.set(handle, {
due: _this.now() + duration,
duration: duration,
handle: handle,
handler: handler,
subscription: _this.schedule(run, duration),
type: 'timeout',
});
return handle;
},
clearTimeout: function (handle) {
var value = scheduleLookup.get(handle);
if (value) {
value.subscription.unsubscribe();
scheduleLookup.delete(handle);
}
},
};
return { immediate: immediate, interval: interval, timeout: timeout };
};
TestScheduler.prototype.run = function (callback) {
var prevFrameTimeFactor = TestScheduler.frameTimeFactor;
var prevMaxFrames = this.maxFrames;
TestScheduler.frameTimeFactor = 1;
this.maxFrames = Infinity;
this.runMode = true;
var animator = this.createAnimator();
var delegates = this.createDelegates();
animationFrameProvider_1.animationFrameProvider.delegate = animator.delegate;
dateTimestampProvider_1.dateTimestampProvider.delegate = this;
immediateProvider_1.immediateProvider.delegate = delegates.immediate;
intervalProvider_1.intervalProvider.delegate = delegates.interval;
timeoutProvider_1.timeoutProvider.delegate = delegates.timeout;
performanceTimestampProvider_1.performanceTimestampProvider.delegate = this;
var helpers = {
cold: this.createColdObservable.bind(this),
hot: this.createHotObservable.bind(this),
flush: this.flush.bind(this),
time: this.createTime.bind(this),
expectObservable: this.expectObservable.bind(this),
expectSubscriptions: this.expectSubscriptions.bind(this),
animate: animator.animate,
};
try {
var ret = callback(helpers);
this.flush();
return ret;
}
finally {
TestScheduler.frameTimeFactor = prevFrameTimeFactor;
this.maxFrames = prevMaxFrames;
this.runMode = false;
animationFrameProvider_1.animationFrameProvider.delegate = undefined;
dateTimestampProvider_1.dateTimestampProvider.delegate = undefined;
immediateProvider_1.immediateProvider.delegate = undefined;
intervalProvider_1.intervalProvider.delegate = undefined;
timeoutProvider_1.timeoutProvider.delegate = undefined;
performanceTimestampProvider_1.performanceTimestampProvider.delegate = undefined;
}
};
TestScheduler.frameTimeFactor = 10;
return TestScheduler;
}(VirtualTimeScheduler_1.VirtualTimeScheduler));
exports.TestScheduler = TestScheduler;
//# sourceMappingURL=TestScheduler.js.map

View File

@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2015 Andrey Sitnik <andrey@sitnik.ru>
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.

View File

@@ -0,0 +1,290 @@
"use strict";
var Buffer = require("safer-buffer").Buffer;
// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152
// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3
exports.utf7 = Utf7Codec;
exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7
function Utf7Codec(codecOptions, iconv) {
this.iconv = iconv;
};
Utf7Codec.prototype.encoder = Utf7Encoder;
Utf7Codec.prototype.decoder = Utf7Decoder;
Utf7Codec.prototype.bomAware = true;
// -- Encoding
var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g;
function Utf7Encoder(options, codec) {
this.iconv = codec.iconv;
}
Utf7Encoder.prototype.write = function(str) {
// Naive implementation.
// Non-direct chars are encoded as "+<base64>-"; single "+" char is encoded as "+-".
return Buffer.from(str.replace(nonDirectChars, function(chunk) {
return "+" + (chunk === '+' ? '' :
this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, ''))
+ "-";
}.bind(this)));
}
Utf7Encoder.prototype.end = function() {
}
// -- Decoding
function Utf7Decoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = '';
}
var base64Regex = /[A-Za-z0-9\/+]/;
var base64Chars = [];
for (var i = 0; i < 256; i++)
base64Chars[i] = base64Regex.test(String.fromCharCode(i));
var plusChar = '+'.charCodeAt(0),
minusChar = '-'.charCodeAt(0),
andChar = '&'.charCodeAt(0);
Utf7Decoder.prototype.write = function(buf) {
var res = "", lastI = 0,
inBase64 = this.inBase64,
base64Accum = this.base64Accum;
// The decoder is more involved as we must handle chunks in stream.
for (var i = 0; i < buf.length; i++) {
if (!inBase64) { // We're in direct mode.
// Write direct chars until '+'
if (buf[i] == plusChar) {
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
lastI = i+1;
inBase64 = true;
}
} else { // We decode base64.
if (!base64Chars[buf[i]]) { // Base64 ended.
if (i == lastI && buf[i] == minusChar) {// "+-" -> "+"
res += "+";
} else {
var b64str = base64Accum + buf.slice(lastI, i).toString();
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
if (buf[i] != minusChar) // Minus is absorbed after base64.
i--;
lastI = i+1;
inBase64 = false;
base64Accum = '';
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
var b64str = base64Accum + buf.slice(lastI).toString();
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
}
Utf7Decoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
this.inBase64 = false;
this.base64Accum = '';
return res;
}
// UTF-7-IMAP codec.
// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3)
// Differences:
// * Base64 part is started by "&" instead of "+"
// * Direct characters are 0x20-0x7E, except "&" (0x26)
// * In Base64, "," is used instead of "/"
// * Base64 must not be used to represent direct characters.
// * No implicit shift back from Base64 (should always end with '-')
// * String must end in non-shifted position.
// * "-&" while in base64 is not allowed.
exports.utf7imap = Utf7IMAPCodec;
function Utf7IMAPCodec(codecOptions, iconv) {
this.iconv = iconv;
};
Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder;
Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder;
Utf7IMAPCodec.prototype.bomAware = true;
// -- Encoding
function Utf7IMAPEncoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = Buffer.alloc(6);
this.base64AccumIdx = 0;
}
Utf7IMAPEncoder.prototype.write = function(str) {
var inBase64 = this.inBase64,
base64Accum = this.base64Accum,
base64AccumIdx = this.base64AccumIdx,
buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0;
for (var i = 0; i < str.length; i++) {
var uChar = str.charCodeAt(i);
if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'.
if (inBase64) {
if (base64AccumIdx > 0) {
bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
inBase64 = false;
}
if (!inBase64) {
buf[bufIdx++] = uChar; // Write direct character
if (uChar === andChar) // Ampersand -> '&-'
buf[bufIdx++] = minusChar;
}
} else { // Non-direct character
if (!inBase64) {
buf[bufIdx++] = andChar; // Write '&', then go to base64 mode.
inBase64 = true;
}
if (inBase64) {
base64Accum[base64AccumIdx++] = uChar >> 8;
base64Accum[base64AccumIdx++] = uChar & 0xFF;
if (base64AccumIdx == base64Accum.length) {
bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx);
base64AccumIdx = 0;
}
}
}
}
this.inBase64 = inBase64;
this.base64AccumIdx = base64AccumIdx;
return buf.slice(0, bufIdx);
}
Utf7IMAPEncoder.prototype.end = function() {
var buf = Buffer.alloc(10), bufIdx = 0;
if (this.inBase64) {
if (this.base64AccumIdx > 0) {
bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx);
this.base64AccumIdx = 0;
}
buf[bufIdx++] = minusChar; // Write '-', then go to direct mode.
this.inBase64 = false;
}
return buf.slice(0, bufIdx);
}
// -- Decoding
function Utf7IMAPDecoder(options, codec) {
this.iconv = codec.iconv;
this.inBase64 = false;
this.base64Accum = '';
}
var base64IMAPChars = base64Chars.slice();
base64IMAPChars[','.charCodeAt(0)] = true;
Utf7IMAPDecoder.prototype.write = function(buf) {
var res = "", lastI = 0,
inBase64 = this.inBase64,
base64Accum = this.base64Accum;
// The decoder is more involved as we must handle chunks in stream.
// It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end).
for (var i = 0; i < buf.length; i++) {
if (!inBase64) { // We're in direct mode.
// Write direct chars until '&'
if (buf[i] == andChar) {
res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars.
lastI = i+1;
inBase64 = true;
}
} else { // We decode base64.
if (!base64IMAPChars[buf[i]]) { // Base64 ended.
if (i == lastI && buf[i] == minusChar) { // "&-" -> "&"
res += "&";
} else {
var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/');
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
if (buf[i] != minusChar) // Minus may be absorbed after base64.
i--;
lastI = i+1;
inBase64 = false;
base64Accum = '';
}
}
}
if (!inBase64) {
res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars.
} else {
var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/');
var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars.
base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future.
b64str = b64str.slice(0, canBeDecoded);
res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be");
}
this.inBase64 = inBase64;
this.base64Accum = base64Accum;
return res;
}
Utf7IMAPDecoder.prototype.end = function() {
var res = "";
if (this.inBase64 && this.base64Accum.length > 0)
res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be");
this.inBase64 = false;
this.base64Accum = '';
return res;
}

View File

@@ -0,0 +1,104 @@
/**
Remove any index signatures from the given object type, so that only explicitly defined properties remain.
Use-cases:
- Remove overly permissive signatures from third-party types.
This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
```
const indexed: Record<string, unknown> = {}; // Allowed
const keyed: Record<'foo', unknown> = {}; // Error
// => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
```
Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
```
type Indexed = {} extends Record<string, unknown>
? '✅ `{}` is assignable to `Record<string, unknown>`'
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
// => '✅ `{}` is assignable to `Record<string, unknown>`'
type Keyed = {} extends Record<'foo' | 'bar', unknown>
? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`"
: "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`";
// => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"
```
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
```
import type {RemoveIndexSignature} from 'type-fest';
type RemoveIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
]: ObjectType[KeyType]; // ...to its original value, i.e. `RemoveIndexSignature<Foo> == Foo`.
};
```
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
```
import type {RemoveIndexSignature} from 'type-fest';
type RemoveIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType
// Is `{}` assignable to `Record<KeyType, unknown>`?
as {} extends Record<KeyType, unknown>
? ... // ✅ `{}` is assignable to `Record<KeyType, unknown>`
: ... // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
]: ObjectType[KeyType];
};
```
If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
```
import type {RemoveIndexSignature} from 'type-fest';
type RemoveIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType
as {} extends Record<KeyType, unknown>
? never // => Remove this `KeyType`.
: KeyType // => Keep this `KeyType` as it is.
]: ObjectType[KeyType];
};
```
@example
```
import type {RemoveIndexSignature} from 'type-fest';
interface Example {
// These index signatures will be removed.
[x: string]: any
[x: number]: any
[x: symbol]: any
[x: `head-${string}`]: string
[x: `${string}-tail`]: string
[x: `head-${string}-tail`]: string
[x: `${bigint}`]: string
[x: `embedded-${number}`]: string
// These explicitly defined keys will remain.
foo: 'bar';
qux?: 'baz';
}
type ExampleWithoutIndexSignatures = RemoveIndexSignature<Example>;
// => { foo: 'bar'; qux?: 'baz' | undefined; }
```
@category Object
*/
export type RemoveIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
? never
: KeyType]: ObjectType[KeyType];
};

View File

@@ -0,0 +1,17 @@
'use strict';
var flags = require('../');
var test = require('tape');
var runTests = require('./tests');
test('as a function', function (t) {
t.test('bad array/this value', function (st) {
st['throws'](function () { flags(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { flags(null); }, TypeError, 'null is not an object');
st.end();
});
runTests(flags, t);
t.end();
});

View File

@@ -0,0 +1 @@
{"version":3,"file":"catchError.js","sourceRoot":"","sources":["../../../../src/internal/operators/catchError.ts"],"names":[],"mappings":";;;AAIA,qDAAoD;AACpD,2DAAgE;AAChE,qCAAuC;AAoGvC,SAAgB,UAAU,CACxB,QAAgD;IAEhD,OAAO,cAAO,CAAC,UAAC,MAAM,EAAE,UAAU;QAChC,IAAI,QAAQ,GAAwB,IAAI,CAAC;QACzC,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,IAAI,aAA6C,CAAC;QAElD,QAAQ,GAAG,MAAM,CAAC,SAAS,CACzB,6CAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAC,GAAG;YAC7D,aAAa,GAAG,qBAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACvE,IAAI,QAAQ,EAAE;gBACZ,QAAQ,CAAC,WAAW,EAAE,CAAC;gBACvB,QAAQ,GAAG,IAAI,CAAC;gBAChB,aAAa,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;aACrC;iBAAM;gBAGL,SAAS,GAAG,IAAI,CAAC;aAClB;QACH,CAAC,CAAC,CACH,CAAC;QAEF,IAAI,SAAS,EAAE;YAMb,QAAQ,CAAC,WAAW,EAAE,CAAC;YACvB,QAAQ,GAAG,IAAI,CAAC;YAChB,aAAc,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;SACtC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAlCD,gCAkCC"}

View File

@@ -0,0 +1 @@
{"name":"@octokit/plugin-rest-endpoint-methods","version":"7.0.1","files":{"LICENSE":{"checkedAt":1678883670445,"integrity":"sha512-bTGv3z196MOWM1pED3fS4NgeOXALRa13dBpWpUu3VkXl8hiIyX8JPYv9CzfWlJeNCJ2lyKm/h5vBQN1NEaBcSQ==","mode":420,"size":1107},"dist-src/endpoints-to-methods.js":{"checkedAt":1678883670525,"integrity":"sha512-StFa8xBAjB2tOg3el36+UmMPQxdZJChSKlcH7vAvLQ9vB7DZP3Do3HeoeFbHhuba/a8Xc065UVwcar8AOgpjdg==","mode":420,"size":2816},"dist-src/generated/endpoints.js":{"checkedAt":1678883670549,"integrity":"sha512-evqeliNV0bGGPOr+7jC5ADpogsMo8Ng+xnIViMhEcET07hhrTLKgqm/j5YCSLODUgnzu/dPfY/PcOCmgtOBK1Q==","mode":420,"size":84070},"dist-node/index.js":{"checkedAt":1678883670561,"integrity":"sha512-5M91hIu27obUuYvxKjQlBTeafgcffe4KjFO7c6MvG4P1CQtFzt2YNH/7A4Foe3KS7Ck+fnBpZvPD11Z0Zm1UEg==","mode":420,"size":73988},"dist-src/index.js":{"checkedAt":1678883670561,"integrity":"sha512-iqYbtR+3T9ugBMvNfuj11PeSpqCD2j3EKtjITmLlN1vaqVPP/yXvsKe9J+ZErhSmM3gF04RYUnNL6Z9Oj1dS7w==","mode":420,"size":539},"dist-web/index.js":{"checkedAt":1678883670576,"integrity":"sha512-mOlFF1jGJVqTLX2b/1E9ExFXzuenixj618wncaibS15ivY8uzaoDjEL1AZ4kgxMiPXw46gqmTK2F6NFCl3UrJA==","mode":420,"size":87355},"dist-src/generated/method-types.js":{"checkedAt":1678883669320,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"dist-src/generated/parameters-and-response-types.js":{"checkedAt":1678883669320,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"dist-src/types.js":{"checkedAt":1678883669320,"integrity":"sha512-TuHIj4w/TkzTTLbAAzm/nW0Db/St469J6HHMiWa4THKdi3VJKsxkE8mmZKwApXlYIjrBPEIp2oxi6+alPk94Pw==","mode":420,"size":11},"dist-src/version.js":{"checkedAt":1678883670576,"integrity":"sha512-7207uWO6Rxa7JTfyhU8SlVJzMZAz1kcdJEEBOuNeJk9yvXuAa33n0PLG6MqeCNtDq3nYOZn2lR1zHLrHxZO6EQ==","mode":420,"size":32},"package.json":{"checkedAt":1678883670576,"integrity":"sha512-mRSpEYWMoi4rmJuKpbyplPyA8zYfxhpddYmuuWtgeB8fehAr2e253GdjK9BP3NDVPkcJ6SkO0wHglYjlFiplrQ==","mode":420,"size":1614},"dist-node/index.js.map":{"checkedAt":1678883670603,"integrity":"sha512-bk8EZSyu+jZI96nmVIt+c8kByMdGFJAitNI8juX7n5m2saRcBL8au8VqYx409rCL+0eTUd/Psc6mYJLBx2fJKw==","mode":420,"size":146466},"dist-web/index.js.map":{"checkedAt":1678883670620,"integrity":"sha512-4q+t5d68wGXhQBmCbJS6Dxka/WgJ3NjIGAbxwoKwyrScqqxOLbILAqt5KNaiT/coYWDQbI/EjaG6sLNhIandhw==","mode":420,"size":135866},"README.md":{"checkedAt":1678883670620,"integrity":"sha512-jhtTl+bNdQc+bmGGx958pg8kMU/Svhfr8ZPoVFYmAlj0wntm8W/C7LpoO6W8U3ZqsRvvIuVM6W+3cTwXOo4l0A==","mode":420,"size":2503},"dist-types/endpoints-to-methods.d.ts":{"checkedAt":1678883670620,"integrity":"sha512-BA5bF4gGDX6YmfMYVUi3ThVDWtNyHQSBnod2348hUGBGICMom+lPKVzjaJAY3InwfsOaKWzuQK+HALf2r/i5SA==","mode":420,"size":294},"dist-types/generated/endpoints.d.ts":{"checkedAt":1678883670620,"integrity":"sha512-2xMOttFoSEj8/60LWsIjRAa7IWCdp3PVWnvwP9GPXMS2GvVvWpYycu2Qyti/6M3hMbpnVR/7YXmUrbLPKAqkJw==","mode":420,"size":144},"dist-types/index.d.ts":{"checkedAt":1678883670620,"integrity":"sha512-nXAc+ouOIH5Uxr1xkxjVPeXiaktyH42Dek8kYaYj1o99PO5BWTKKF+oGFLkOSAdGIuxboFFTVOH7NUuW3nBuGw==","mode":420,"size":467},"dist-types/generated/method-types.d.ts":{"checkedAt":1678883670689,"integrity":"sha512-GEu2oE0a2dk2GCjVhzoIqC+1lO4Gr2gshfu3wmjhKrOTDOhdC3td3JroOIcXhy3u/71JZMW5bCns/X0XOAr3Xw==","mode":420,"size":692592},"dist-types/types.d.ts":{"checkedAt":1678883670690,"integrity":"sha512-os6RLvwVF0IkFaiHos/JmEiMsxfaW3ugSji5V0kmIAZsN1K8Ygt+gCh2wUU3yAX9IxsMiLEHN7PvBqV1RzxnzA==","mode":420,"size":524},"dist-types/version.d.ts":{"checkedAt":1678883670690,"integrity":"sha512-IczU/0U348jzlpfwpS1G/cokBGCMwaE2tHFTFLMfe2fTDxFPGdaBSwWDTcATWWY2hba9C4hzNOTd1J02H5i4Dg==","mode":420,"size":40},"dist-types/generated/parameters-and-response-types.d.ts":{"checkedAt":1678883670690,"integrity":"sha512-oflCFg2wWaW6WNPCyu4lJYOwGzt/RmL0IVrEhcK0vD8l4uvSlo00dEdXvEM4MKMfkzQxYi+sV2yaoyWVoVb5wg==","mode":420,"size":255659}}}

View File

@@ -0,0 +1,6 @@
export declare function destroy_block(block: any, lookup: any): void;
export declare function outro_and_destroy_block(block: any, lookup: any): void;
export declare function fix_and_destroy_block(block: any, lookup: any): void;
export declare function fix_and_outro_and_destroy_block(block: any, lookup: any): void;
export declare function update_keyed_each(old_blocks: any, dirty: any, get_key: any, dynamic: any, ctx: any, list: any, lookup: any, node: any, destroy: any, create_each_block: any, next: any, get_context: any): any[];
export declare function validate_each_keys(ctx: any, list: any, get_context: any, get_key: any): void;

View File

@@ -0,0 +1,19 @@
import { Observable } from '../Observable';
import { ConnectableObservable } from '../observable/ConnectableObservable';
import { UnaryFunction } from '../types';
/**
* Creates a {@link ConnectableObservable} that utilizes a {@link BehaviorSubject}.
*
* @param initialValue The initial value passed to the {@link BehaviorSubject}.
* @return A function that returns a {@link ConnectableObservable}
* @deprecated Will be removed in v8. To create a connectable observable that uses a
* {@link BehaviorSubject} under the hood, use {@link connectable}.
* `source.pipe(publishBehavior(initValue))` is equivalent to
* `connectable(source, { connector: () => new BehaviorSubject(initValue), resetOnDisconnect: false })`.
* If you're using {@link refCount} after `publishBehavior`, use the {@link share} operator instead.
* `source.pipe(publishBehavior(initValue), refCount())` is equivalent to
* `source.pipe(share({ connector: () => new BehaviorSubject(initValue), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`.
* Details: https://rxjs.dev/deprecations/multicasting
*/
export declare function publishBehavior<T>(initialValue: T): UnaryFunction<Observable<T>, ConnectableObservable<T>>;
//# sourceMappingURL=publishBehavior.d.ts.map

View File

@@ -0,0 +1,4 @@
import { AsyncScheduler } from './AsyncScheduler';
export declare class QueueScheduler extends AsyncScheduler {
}
//# sourceMappingURL=QueueScheduler.d.ts.map

View File

@@ -0,0 +1,162 @@
"use strict";
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(exports, "__esModule", { value: true });
exports.randomBytes = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.checkOpts = exports.Hash = exports.concatBytes = exports.toBytes = exports.utf8ToBytes = exports.asyncLoop = exports.nextTick = exports.hexToBytes = exports.bytesToHex = exports.isLE = exports.rotr = exports.createView = exports.u32 = exports.u8 = void 0;
// The import here is via the package name. This is to ensure
// that exports mapping/resolution does fall into place.
const crypto_1 = require("@noble/hashes/crypto");
// Cast array to different type
const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
exports.u8 = u8;
const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
exports.u32 = u32;
// Cast array to view
const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
exports.createView = createView;
// The rotate right (circular right shift) operation for uint32
const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);
exports.rotr = rotr;
exports.isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;
// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.
// So, just to be sure not to corrupt anything.
if (!exports.isLE)
throw new Error('Non little-endian hardware is not supported');
const hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));
/**
* @example bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]))
*/
function bytesToHex(uint8a) {
// pre-caching improves the speed 6x
if (!(uint8a instanceof Uint8Array))
throw new Error('Uint8Array expected');
let hex = '';
for (let i = 0; i < uint8a.length; i++) {
hex += hexes[uint8a[i]];
}
return hex;
}
exports.bytesToHex = bytesToHex;
/**
* @example hexToBytes('deadbeef')
*/
function hexToBytes(hex) {
if (typeof hex !== 'string') {
throw new TypeError('hexToBytes: expected string, got ' + typeof hex);
}
if (hex.length % 2)
throw new Error('hexToBytes: received invalid unpadded hex');
const array = new Uint8Array(hex.length / 2);
for (let i = 0; i < array.length; i++) {
const j = i * 2;
const hexByte = hex.slice(j, j + 2);
const byte = Number.parseInt(hexByte, 16);
if (Number.isNaN(byte) || byte < 0)
throw new Error('Invalid byte sequence');
array[i] = byte;
}
return array;
}
exports.hexToBytes = hexToBytes;
// There is no setImmediate in browser and setTimeout is slow. However, call to async function will return Promise
// which will be fullfiled only on next scheduler queue processing step and this is exactly what we need.
const nextTick = async () => { };
exports.nextTick = nextTick;
// Returns control to thread each 'tick' ms to avoid blocking
async function asyncLoop(iters, tick, cb) {
let ts = Date.now();
for (let i = 0; i < iters; i++) {
cb(i);
// Date.now() is not monotonic, so in case if clock goes backwards we return return control too
const diff = Date.now() - ts;
if (diff >= 0 && diff < tick)
continue;
await (0, exports.nextTick)();
ts += diff;
}
}
exports.asyncLoop = asyncLoop;
function utf8ToBytes(str) {
if (typeof str !== 'string') {
throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);
}
return new TextEncoder().encode(str);
}
exports.utf8ToBytes = utf8ToBytes;
function toBytes(data) {
if (typeof data === 'string')
data = utf8ToBytes(data);
if (!(data instanceof Uint8Array))
throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);
return data;
}
exports.toBytes = toBytes;
/**
* Concats Uint8Array-s into one; like `Buffer.concat([buf1, buf2])`
* @example concatBytes(buf1, buf2)
*/
function concatBytes(...arrays) {
if (!arrays.every((a) => a instanceof Uint8Array))
throw new Error('Uint8Array list expected');
if (arrays.length === 1)
return arrays[0];
const length = arrays.reduce((a, arr) => a + arr.length, 0);
const result = new Uint8Array(length);
for (let i = 0, pad = 0; i < arrays.length; i++) {
const arr = arrays[i];
result.set(arr, pad);
pad += arr.length;
}
return result;
}
exports.concatBytes = concatBytes;
// For runtime check if class implements interface
class Hash {
// Safe version that clones internal state
clone() {
return this._cloneInto();
}
}
exports.Hash = Hash;
// Check if object doens't have custom constructor (like Uint8Array/Array)
const isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;
function checkOpts(defaults, opts) {
if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))
throw new TypeError('Options should be object or undefined');
const merged = Object.assign(defaults, opts);
return merged;
}
exports.checkOpts = checkOpts;
function wrapConstructor(hashConstructor) {
const hashC = (message) => hashConstructor().update(toBytes(message)).digest();
const tmp = hashConstructor();
hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen;
hashC.create = () => hashConstructor();
return hashC;
}
exports.wrapConstructor = wrapConstructor;
function wrapConstructorWithOpts(hashCons) {
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
const tmp = hashCons({});
hashC.outputLen = tmp.outputLen;
hashC.blockLen = tmp.blockLen;
hashC.create = (opts) => hashCons(opts);
return hashC;
}
exports.wrapConstructorWithOpts = wrapConstructorWithOpts;
/**
* Secure PRNG
*/
function randomBytes(bytesLength = 32) {
if (crypto_1.crypto.web) {
return crypto_1.crypto.web.getRandomValues(new Uint8Array(bytesLength));
}
else if (crypto_1.crypto.node) {
return new Uint8Array(crypto_1.crypto.node.randomBytes(bytesLength).buffer);
}
else {
throw new Error("The environment doesn't have randomBytes function");
}
}
exports.randomBytes = randomBytes;
//# sourceMappingURL=utils.js.map

View File

@@ -0,0 +1 @@
module.exports={A:{A:{"2":"J D CC","260":"E","388":"F A B"},B:{"1":"G M N O P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H","388":"C K L"},C:{"1":"0 1 2 3 4 5 6 7 8 9 DC tB I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB EC FC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 I v J D E F A B C K L G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB uB ZB vB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R S T U V W X Y Z a b c d e i j k l m n o p q r s t u f H xB yB GC"},E:{"1":"I v J D E F A B C K L G HC zB IC JC KC LC 0B qB rB 1B MC NC 2B 3B 4B 5B sB 6B 7B 8B 9B OC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 C G M N O w g x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB h lB mB nB oB pB P Q R wB S T U V W X Y Z a b c d e TC","129":"rB","260":"F B PC QC RC SC qB AC"},G:{"1":"E zB UC BC VC WC XC YC ZC aC bC cC dC eC fC gC hC iC jC kC lC mC nC 2B 3B 4B 5B sB 6B 7B 8B 9B"},H:{"2":"oC"},I:{"1":"tB I f pC qC rC sC BC tC uC"},J:{"1":"D A"},K:{"1":"C h rB","260":"A B qB AC"},L:{"1":"H"},M:{"1":"H"},N:{"388":"A B"},O:{"1":"vC"},P:{"1":"I g wC xC yC zC 0C 0B 1C 2C 3C 4C 5C sB 6C 7C 8C"},Q:{"1":"1B"},R:{"1":"9C"},S:{"1":"AD BD"}},B:4,C:"CSS outline properties"};

View File

@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StatusService = void 0;
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
const request_1 = require("../core/request");
class StatusService {
/**
* Get
* A very basic status/health endpoint that just checks if the database connection is available. <br> The available information depth will be expanded later.
* @result any Successful response
* @throws ApiError
*/
static async statusControllerGet() {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/status`,
});
return result.body;
}
/**
* Get version
* A very basic endpoint that just returns the curent package version.
* @result any Successful response
* @throws ApiError
*/
static async statusControllerGetVersion() {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/version`,
});
return result.body;
}
}
exports.StatusService = StatusService;

View File

@@ -0,0 +1,26 @@
# Error
_Error_ instance
## `error/is`
Confirms if given object is a native error object
```javascript
const isError = require("type/error/is");
isError(new Error()); // true
isError({ message: "Fake error" }); // false
```
## `error/ensure`
If given argument is an error object, it is returned back. Otherwise `TypeError` is thrown.
```javascript
const ensureError = require("type/error/ensure");
const someError = new Error("Some error");
ensureError(someError); // someError
ensureError({ message: "Fake error" }); // Thrown TypeError: [object Object] is not an error object
```

View File

@@ -0,0 +1,51 @@
const SemVer = require('../classes/semver')
const parse = require('./parse')
const {re, t} = require('../internal/re')
const coerce = (version, options) => {
if (version instanceof SemVer) {
return version
}
if (typeof version === 'number') {
version = String(version)
}
if (typeof version !== 'string') {
return null
}
options = options || {}
let match = null
if (!options.rtl) {
match = version.match(re[t.COERCE])
} else {
// Find the right-most coercible string that does not share
// a terminus with a more left-ward coercible string.
// Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
//
// Walk through the string checking with a /g regexp
// Manually set the index so as to pick up overlapping matches.
// Stop when we get a match that ends at the string end, since no
// coercible string can be more right-ward without the same terminus.
let next
while ((next = re[t.COERCERTL].exec(version)) &&
(!match || match.index + match[0].length !== version.length)
) {
if (!match ||
next.index + next[0].length !== match.index + match[0].length) {
match = next
}
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
}
// leave it in a clean state
re[t.COERCERTL].lastIndex = -1
}
if (match === null)
return null
return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
}
module.exports = coerce

View File

@@ -0,0 +1,16 @@
import { __read, __spreadArray } from "tslib";
import { raceInit } from '../observable/race';
import { operate } from '../util/lift';
import { identity } from '../util/identity';
export function raceWith() {
var otherSources = [];
for (var _i = 0; _i < arguments.length; _i++) {
otherSources[_i] = arguments[_i];
}
return !otherSources.length
? identity
: operate(function (source, subscriber) {
raceInit(__spreadArray([source], __read(otherSources)))(subscriber);
});
}
//# sourceMappingURL=raceWith.js.map

View File

@@ -0,0 +1,28 @@
"use strict";
exports.__esModule = true;
exports.UNIVERSAL = exports.ATTRIBUTE = exports.CLASS = exports.COMBINATOR = exports.COMMENT = exports.ID = exports.NESTING = exports.PSEUDO = exports.ROOT = exports.SELECTOR = exports.STRING = exports.TAG = void 0;
var TAG = 'tag';
exports.TAG = TAG;
var STRING = 'string';
exports.STRING = STRING;
var SELECTOR = 'selector';
exports.SELECTOR = SELECTOR;
var ROOT = 'root';
exports.ROOT = ROOT;
var PSEUDO = 'pseudo';
exports.PSEUDO = PSEUDO;
var NESTING = 'nesting';
exports.NESTING = NESTING;
var ID = 'id';
exports.ID = ID;
var COMMENT = 'comment';
exports.COMMENT = COMMENT;
var COMBINATOR = 'combinator';
exports.COMBINATOR = COMBINATOR;
var CLASS = 'class';
exports.CLASS = CLASS;
var ATTRIBUTE = 'attribute';
exports.ATTRIBUTE = ATTRIBUTE;
var UNIVERSAL = 'universal';
exports.UNIVERSAL = UNIVERSAL;

View File

@@ -0,0 +1,34 @@
import type {PascalCase} from './pascal-case';
/**
Convert object properties to pascal case but not recursively.
This can be useful when, for example, converting some API types from a different style.
@see PascalCase
@see PascalCasedPropertiesDeep
@example
```
import type {PascalCasedProperties} from 'type-fest';
interface User {
userId: number;
userName: string;
}
const result: PascalCasedProperties<User> = {
UserId: 1,
UserName: 'Tom',
};
```
@category Change case
@category Template literal
@category Object
*/
export type PascalCasedProperties<Value> = Value extends Function
? Value
: Value extends Array<infer U>
? Value
: {[K in keyof Value as PascalCase<K>]: Value[K]};

View File

@@ -0,0 +1,151 @@
import { Action } from './Action';
import { SchedulerAction } from '../types';
import { Subscription } from '../Subscription';
import { AsyncScheduler } from './AsyncScheduler';
import { intervalProvider } from './intervalProvider';
import { arrRemove } from '../util/arrRemove';
import { TimerHandle } from './timerHandle';
export class AsyncAction<T> extends Action<T> {
public id: TimerHandle | undefined;
public state?: T;
// @ts-ignore: Property has no initializer and is not definitely assigned
public delay: number;
protected pending: boolean = false;
constructor(protected scheduler: AsyncScheduler, protected work: (this: SchedulerAction<T>, state?: T) => void) {
super(scheduler, work);
}
public schedule(state?: T, delay: number = 0): Subscription {
if (this.closed) {
return this;
}
// Always replace the current state with the new state.
this.state = state;
const id = this.id;
const scheduler = this.scheduler;
//
// Important implementation note:
//
// Actions only execute once by default, unless rescheduled from within the
// scheduled callback. This allows us to implement single and repeat
// actions via the same code path, without adding API surface area, as well
// as mimic traditional recursion but across asynchronous boundaries.
//
// However, JS runtimes and timers distinguish between intervals achieved by
// serial `setTimeout` calls vs. a single `setInterval` call. An interval of
// serial `setTimeout` calls can be individually delayed, which delays
// scheduling the next `setTimeout`, and so on. `setInterval` attempts to
// guarantee the interval callback will be invoked more precisely to the
// interval period, regardless of load.
//
// Therefore, we use `setInterval` to schedule single and repeat actions.
// If the action reschedules itself with the same delay, the interval is not
// canceled. If the action doesn't reschedule, or reschedules with a
// different delay, the interval will be canceled after scheduled callback
// execution.
//
if (id != null) {
this.id = this.recycleAsyncId(scheduler, id, delay);
}
// Set the pending flag indicating that this action has been scheduled, or
// has recursively rescheduled itself.
this.pending = true;
this.delay = delay;
// If this action has already an async Id, don't request a new one.
this.id = this.id ?? this.requestAsyncId(scheduler, this.id, delay);
return this;
}
protected requestAsyncId(scheduler: AsyncScheduler, _id?: TimerHandle, delay: number = 0): TimerHandle {
return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);
}
protected recycleAsyncId(_scheduler: AsyncScheduler, id?: TimerHandle, delay: number | null = 0): TimerHandle | undefined {
// If this action is rescheduled with the same delay time, don't clear the interval id.
if (delay != null && this.delay === delay && this.pending === false) {
return id;
}
// Otherwise, if the action's delay time is different from the current delay,
// or the action has been rescheduled before it's executed, clear the interval id
if (id != null) {
intervalProvider.clearInterval(id);
}
return undefined;
}
/**
* Immediately executes this action and the `work` it contains.
* @return {any}
*/
public execute(state: T, delay: number): any {
if (this.closed) {
return new Error('executing a cancelled action');
}
this.pending = false;
const error = this._execute(state, delay);
if (error) {
return error;
} else if (this.pending === false && this.id != null) {
// Dequeue if the action didn't reschedule itself. Don't call
// unsubscribe(), because the action could reschedule later.
// For example:
// ```
// scheduler.schedule(function doWork(counter) {
// /* ... I'm a busy worker bee ... */
// var originalAction = this;
// /* wait 100ms before rescheduling the action */
// setTimeout(function () {
// originalAction.schedule(counter + 1);
// }, 100);
// }, 1000);
// ```
this.id = this.recycleAsyncId(this.scheduler, this.id, null);
}
}
protected _execute(state: T, _delay: number): any {
let errored: boolean = false;
let errorValue: any;
try {
this.work(state);
} catch (e) {
errored = true;
// HACK: Since code elsewhere is relying on the "truthiness" of the
// return here, we can't have it return "" or 0 or false.
// TODO: Clean this up when we refactor schedulers mid-version-8 or so.
errorValue = e ? e : new Error('Scheduled action threw falsy error');
}
if (errored) {
this.unsubscribe();
return errorValue;
}
}
unsubscribe() {
if (!this.closed) {
const { id, scheduler } = this;
const { actions } = scheduler;
this.work = this.state = this.scheduler = null!;
this.pending = false;
arrRemove(actions, this);
if (id != null) {
this.id = this.recycleAsyncId(scheduler, id, null);
}
this.delay = null!;
super.unsubscribe();
}
}
}

View File

@@ -0,0 +1,38 @@
{
"name": "core-util-is",
"version": "1.0.3",
"description": "The `util.is*` functions introduced in Node v0.12.",
"main": "lib/util.js",
"files": [
"lib"
],
"repository": {
"type": "git",
"url": "git://github.com/isaacs/core-util-is"
},
"keywords": [
"util",
"isBuffer",
"isArray",
"isNumber",
"isString",
"isRegExp",
"isThis",
"isThat",
"polyfill"
],
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
"license": "MIT",
"bugs": {
"url": "https://github.com/isaacs/core-util-is/issues"
},
"scripts": {
"test": "tap test.js",
"preversion": "npm test",
"postversion": "npm publish",
"prepublishOnly": "git push origin --follow-tags"
},
"devDependencies": {
"tap": "^15.0.9"
}
}

View File

@@ -0,0 +1,18 @@
"use strict";
var toPosInt = require("../number/to-pos-integer")
, value = require("../object/valid-value")
, slice = Array.prototype.slice;
module.exports = function (length /*, …fill*/) {
var arr, currentLength;
length = toPosInt(value(length));
if (length === 0) return [];
arr = arguments.length < 2 ? [undefined] : slice.call(arguments, 1, 1 + length);
while ((currentLength = arr.length) < length) {
arr = arr.concat(arr.slice(0, length - currentLength));
}
return arr;
};

View File

@@ -0,0 +1,81 @@
const fs = require('fs');
const globrex = require('globrex');
const globalyzer = require('globalyzer');
const { join, resolve, relative } = require('path');
const isHidden = /(^|[\\\/])\.[^\\\/\.]/g;
let CACHE = {};
function walk(output, prefix, lexer, opts, dirname='', level=0) {
const rgx = lexer.segments[level];
const dir = resolve(opts.cwd, prefix, dirname);
const files = fs.readdirSync(dir);
const { dot, filesOnly } = opts;
let i=0, len=files.length, file;
let fullpath, relpath, stats, isMatch;
for (; i < len; i++) {
fullpath = join(dir, file=files[i]);
relpath = dirname ? join(dirname, file) : file;
if (!dot && isHidden.test(relpath)) continue;
isMatch = lexer.regex.test(relpath);
if ((stats=CACHE[relpath]) === void 0) {
CACHE[relpath] = stats = fs.lstatSync(fullpath);
}
if (!stats.isDirectory()) {
isMatch && output.push(relative(opts.cwd, fullpath));
continue;
}
if (rgx && !rgx.test(file)) continue;
!filesOnly && isMatch && output.push(join(prefix, relpath));
walk(output, prefix, lexer, opts, relpath, rgx && rgx.toString() !== lexer.globstar && level + 1);
}
}
/**
* Find files using bash-like globbing.
* All paths are normalized compared to node-glob.
* @param {String} str Glob string
* @param {String} [options.cwd='.'] Current working directory
* @param {Boolean} [options.dot=false] Include dotfile matches
* @param {Boolean} [options.absolute=false] Return absolute paths
* @param {Boolean} [options.filesOnly=false] Do not include folders if true
* @param {Boolean} [options.flush=false] Reset cache object
* @returns {Array} array containing matching files
*/
module.exports = function (str, opts={}) {
if (!str) return [];
let glob = globalyzer(str);
opts.cwd = opts.cwd || '.';
if (!glob.isGlob) {
try {
let resolved = resolve(opts.cwd, str);
let dirent = fs.statSync(resolved);
if (opts.filesOnly && !dirent.isFile()) return [];
return opts.absolute ? [resolved] : [str];
} catch (err) {
if (err.code != 'ENOENT') throw err;
return [];
}
}
if (opts.flush) CACHE = {};
let matches = [];
const { path } = globrex(glob.glob, { filepath:true, globstar:true, extended:true });
path.globstar = path.globstar.toString();
walk(matches, glob.base, path, opts, '.', 0);
return opts.absolute ? matches.map(x => resolve(opts.cwd, x)) : matches;
};

View File

@@ -0,0 +1,102 @@
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for csv2json/libs/core/csvline.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../../../prettify.css" />
<link rel="stylesheet" href="../../../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../../../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../../../index.html">All files</a> / <a href="index.html">csv2json/libs/core</a> csvline.js
</h1>
<div class='clearfix'>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Statements</span>
<span class='fraction'>0/13</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Branches</span>
<span class='fraction'>0/6</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Functions</span>
<span class='fraction'>0/1</span>
</div>
<div class='fl pad1y space-right2'>
<span class="strong">0% </span>
<span class="quiet">Lines</span>
<span class='fraction'>0/13</span>
</div>
</div>
<p class="quiet">
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
</p>
</div>
<div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
<a name='L2'></a><a href='#L2'>2</a>
<a name='L3'></a><a href='#L3'>3</a>
<a name='L4'></a><a href='#L4'>4</a>
<a name='L5'></a><a href='#L5'>5</a>
<a name='L6'></a><a href='#L6'>6</a>
<a name='L7'></a><a href='#L7'>7</a>
<a name='L8'></a><a href='#L8'>8</a>
<a name='L9'></a><a href='#L9'>9</a>
<a name='L10'></a><a href='#L10'>10</a>
<a name='L11'></a><a href='#L11'>11</a>
<a name='L12'></a><a href='#L12'>12</a></td><td class="line-coverage quiet"><span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span>
<span class="cline-any cline-no">0</span></td><td class="text"><pre class="prettyprint lang-js">Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/csvline.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/csvline.js')
Error: Unable to lookup source: /Users/kxiang/work/projects/csv2json/libs/core/csvline.js(ENOENT: no such file or directory, open '/Users/kxiang/work/projects/csv2json/libs/core/csvline.js')
at Context.defaultSourceLookup [as sourceFinder] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:15:15)
at Context.getSource (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/context.js:74:17)
at Object.annotateSourceCode (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/annotator.js:172:38)
at HtmlReport.onDetail (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-reports/lib/html/index.js:237:39)
at Visitor.(anonymous function) [as onDetail] (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:34:30)
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:123:17)
at /Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:116:23
at Array.forEach (native)
at visitChildren (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:115:32)
at ReportNode.Node.visit (/Users/kxiang/work/projects/csv2json/node_modules/nyc/node_modules/istanbul-lib-report/lib/tree.js:126:5)</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Fri May 11 2018 21:36:07 GMT+0100 (IST)
</div>
</div>
<script src="../../../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../../../sorter.js"></script>
<script src="../../../block-navigation.js"></script>
</body>
</html>

View File

@@ -0,0 +1,40 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.timer = void 0;
var Observable_1 = require("../Observable");
var async_1 = require("../scheduler/async");
var isScheduler_1 = require("../util/isScheduler");
var isDate_1 = require("../util/isDate");
function timer(dueTime, intervalOrScheduler, scheduler) {
if (dueTime === void 0) { dueTime = 0; }
if (scheduler === void 0) { scheduler = async_1.async; }
var intervalDuration = -1;
if (intervalOrScheduler != null) {
if (isScheduler_1.isScheduler(intervalOrScheduler)) {
scheduler = intervalOrScheduler;
}
else {
intervalDuration = intervalOrScheduler;
}
}
return new Observable_1.Observable(function (subscriber) {
var due = isDate_1.isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;
if (due < 0) {
due = 0;
}
var n = 0;
return scheduler.schedule(function () {
if (!subscriber.closed) {
subscriber.next(n++);
if (0 <= intervalDuration) {
this.schedule(undefined, intervalDuration);
}
else {
subscriber.complete();
}
}
}, due);
});
}
exports.timer = timer;
//# sourceMappingURL=timer.js.map

View File

@@ -0,0 +1,30 @@
{
"name": "@formatjs/intl-localematcher",
"version": "0.2.25",
"description": "Intl.LocaleMatcher ponyfill",
"keywords": [
"intl",
"locale",
"formatjs",
"react-intl",
"i18n",
"ecma402",
"tc39"
],
"author": "Long Ho <holevietlong@gmail.com>",
"homepage": "https://github.com/formatjs/formatjs#readme",
"license": "MIT",
"main": "index.js",
"module": "lib/index.js",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/formatjs/formatjs.git"
},
"bugs": {
"url": "https://github.com/formatjs/formatjs/issues"
},
"dependencies": {
"tslib": "^2.1.0"
}
}

View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2019 ehmicky <ehmicky@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,191 @@
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { Duplex } from 'node:stream';
import { URL } from 'node:url';
import type { ClientRequest } from 'node:http';
import type { Socket } from 'node:net';
import type { Timings } from '@szmarczak/http-timer';
import Options from './options.js';
import { type PlainResponse, type Response } from './response.js';
import { RequestError } from './errors.js';
type Error = NodeJS.ErrnoException;
export type Progress = {
percent: number;
transferred: number;
total?: number;
};
export type GotEventFunction<T> =
/**
`request` event to get the request object of the request.
__Tip__: You can use `request` event to abort requests.
@example
```
import got from 'got';
got.stream('https://github.com')
.on('request', request => setTimeout(() => request.destroy(), 50));
```
*/
((name: 'request', listener: (request: ClientRequest) => void) => T)
/**
The `response` event to get the response object of the final request.
*/
& (<R extends Response>(name: 'response', listener: (response: R) => void) => T)
/**
The `redirect` event to get the response object of a redirect. The second argument is options for the next request to the redirect location.
*/
& (<R extends Response, N extends Options>(name: 'redirect', listener: (response: R, nextOptions: N) => void) => T)
/**
Progress events for uploading (sending a request) and downloading (receiving a response).
The `progress` argument is an object like:
```
{
percent: 0.1,
transferred: 1024,
total: 10240
}
```
If the `content-length` header is missing, `total` will be `undefined`.
@example
```
import got from 'got';
const response = await got('https://sindresorhus.com')
.on('downloadProgress', progress => {
// Report download progress
})
.on('uploadProgress', progress => {
// Report upload progress
});
console.log(response);
```
*/
& ((name: 'uploadProgress' | 'downloadProgress', listener: (progress: Progress) => void) => T)
/**
To enable retrying on a Got stream, it is required to have a `retry` handler attached.
When this event is emitted, you should reset the stream you were writing to and prepare the body again.
See `got.options.retry` for more information.
*/
& ((name: 'retry', listener: (retryCount: number, error: RequestError) => void) => T);
export type RequestEvents<T> = {
on: GotEventFunction<T>;
once: GotEventFunction<T>;
off: GotEventFunction<T>;
};
type UrlType = ConstructorParameters<typeof Options>[0];
type OptionsType = ConstructorParameters<typeof Options>[1];
type DefaultsType = ConstructorParameters<typeof Options>[2];
export default class Request extends Duplex implements RequestEvents<Request> {
['constructor']: typeof Request;
_noPipe?: boolean;
options: Options;
response?: PlainResponse;
requestUrl?: URL;
redirectUrls: URL[];
retryCount: number;
private _requestOptions;
private _stopRetry;
private _downloadedSize;
private _uploadedSize;
private _stopReading;
private readonly _pipedServerResponses;
private _request?;
private _responseSize?;
private _bodySize?;
private _unproxyEvents;
private _isFromCache?;
private _cannotHaveBody;
private _triggerRead;
private _jobs;
private _cancelTimeouts;
private readonly _removeListeners;
private _nativeResponse?;
private _flushed;
private _aborted;
private _requestInitialized;
constructor(url: UrlType, options?: OptionsType, defaults?: DefaultsType);
flush(): Promise<void>;
_beforeError(error: Error): void;
_read(): void;
_write(chunk: unknown, encoding: BufferEncoding | undefined, callback: (error?: Error | null) => void): void;
_final(callback: (error?: Error | null) => void): void;
_destroy(error: Error | null, callback: (error: Error | null) => void): void;
pipe<T extends NodeJS.WritableStream>(destination: T, options?: {
end?: boolean;
}): T;
unpipe<T extends NodeJS.WritableStream>(destination: T): this;
private _finalizeBody;
private _onResponseBase;
private _setRawBody;
private _onResponse;
private _onRequest;
private _asyncWrite;
private _sendBody;
private _prepareCache;
private _createCacheableRequest;
private _makeRequest;
private _error;
private _writeRequest;
/**
The remote IP address.
*/
get ip(): string | undefined;
/**
Indicates whether the request has been aborted or not.
*/
get isAborted(): boolean;
get socket(): Socket | undefined;
/**
Progress event for downloading (receiving a response).
*/
get downloadProgress(): Progress;
/**
Progress event for uploading (sending a request).
*/
get uploadProgress(): Progress;
/**
The object contains the following properties:
- `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.
- `secureConnect` - Time when the socket securely connected.
- `upload` - Time when the request finished uploading.
- `response` - Time when the request fired `response` event.
- `end` - Time when the response fired `end` event.
- `error` - Time when the request fired `error` event.
- `abort` - Time when the request fired `abort` event.
- `phases`
- `wait` - `timings.socket - timings.start`
- `dns` - `timings.lookup - timings.socket`
- `tcp` - `timings.connect - timings.lookup`
- `tls` - `timings.secureConnect - timings.connect`
- `request` - `timings.upload - (timings.secureConnect || timings.connect)`
- `firstByte` - `timings.response - timings.upload`
- `download` - `timings.end - timings.response`
- `total` - `(timings.end || timings.error || timings.abort) - timings.start`
If something has not been measured yet, it will be `undefined`.
__Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
*/
get timings(): Timings | undefined;
/**
Whether the response was retrieved from the cache.
*/
get isFromCache(): boolean | undefined;
get reusedSocket(): boolean | undefined;
}
export {};

View File

@@ -0,0 +1,7 @@
import { EnsureBaseOptions, EnsureIsOptional, EnsureDefault } from '../ensure';
declare function ensureError(value: any, options?: EnsureBaseOptions): Error;
declare function ensureError(value: any, options?: EnsureBaseOptions & EnsureIsOptional): Error | null;
declare function ensureError(value: any, options?: EnsureBaseOptions & EnsureIsOptional & EnsureDefault<Error>): Error;
export default ensureError;

View File

@@ -0,0 +1,52 @@
# is-regex <sup>[![Version Badge][2]][1]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][5]][6]
[![dev dependency status][7]][8]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][11]][1]
Is this value a JS regex?
This module works cross-realm/iframe, and despite ES6 @@toStringTag.
## Example
```js
var isRegex = require('is-regex');
var assert = require('assert');
assert.notOk(isRegex(undefined));
assert.notOk(isRegex(null));
assert.notOk(isRegex(false));
assert.notOk(isRegex(true));
assert.notOk(isRegex(42));
assert.notOk(isRegex('foo'));
assert.notOk(isRegex(function () {}));
assert.notOk(isRegex([]));
assert.notOk(isRegex({}));
assert.ok(isRegex(/a/g));
assert.ok(isRegex(new RegExp('a', 'g')));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[1]: https://npmjs.org/package/is-regex
[2]: https://versionbadg.es/inspect-js/is-regex.svg
[5]: https://david-dm.org/inspect-js/is-regex.svg
[6]: https://david-dm.org/inspect-js/is-regex
[7]: https://david-dm.org/inspect-js/is-regex/dev-status.svg
[8]: https://david-dm.org/inspect-js/is-regex#info=devDependencies
[11]: https://nodei.co/npm/is-regex.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/is-regex.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/is-regex.svg
[downloads-url]: https://npm-stat.com/charts.html?package=is-regex
[codecov-image]: https://codecov.io/gh/inspect-js/is-regex/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/inspect-js/is-regex/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-regex
[actions-url]: https://github.com/inspect-js/is-regex/actions

View File

@@ -0,0 +1,54 @@
// @ts-check
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
loadPostcss: ()=>loadPostcss,
loadPostcssImport: ()=>loadPostcssImport,
loadCssNano: ()=>loadCssNano,
loadAutoprefixer: ()=>loadAutoprefixer
});
const _indexJs = require("../../../peers/index.js");
function loadPostcss() {
// Try to load a local `postcss` version first
try {
return require("postcss");
} catch {}
return (0, _indexJs.lazyPostcss)();
}
function loadPostcssImport() {
// Try to load a local `postcss-import` version first
try {
return require("postcss-import");
} catch {}
return (0, _indexJs.lazyPostcssImport)();
}
function loadCssNano() {
let options = {
preset: [
"default",
{
cssDeclarationSorter: false
}
]
};
// Try to load a local `cssnano` version first
try {
return require("cssnano");
} catch {}
return (0, _indexJs.lazyCssnano)()(options);
}
function loadAutoprefixer() {
// Try to load a local `autoprefixer` version first
try {
return require("autoprefixer");
} catch {}
return (0, _indexJs.lazyAutoprefixer)();
}

View File

@@ -0,0 +1,118 @@
// @ts-check
import { WalkerBase } from './walker.js';
/** @typedef { import('estree').BaseNode} BaseNode */
/** @typedef { import('./walker.js').WalkerContext} WalkerContext */
/** @typedef {(
* this: WalkerContext,
* node: BaseNode,
* parent: BaseNode,
* key: string,
* index: number
* ) => void} SyncHandler */
export class SyncWalker extends WalkerBase {
/**
*
* @param {SyncHandler} enter
* @param {SyncHandler} leave
*/
constructor(enter, leave) {
super();
/** @type {SyncHandler} */
this.enter = enter;
/** @type {SyncHandler} */
this.leave = leave;
}
/**
*
* @param {BaseNode} node
* @param {BaseNode} parent
* @param {string} [prop]
* @param {number} [index]
* @returns {BaseNode}
*/
visit(node, parent, prop, index) {
if (node) {
if (this.enter) {
const _should_skip = this.should_skip;
const _should_remove = this.should_remove;
const _replacement = this.replacement;
this.should_skip = false;
this.should_remove = false;
this.replacement = null;
this.enter.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const skipped = this.should_skip;
const removed = this.should_remove;
this.should_skip = _should_skip;
this.should_remove = _should_remove;
this.replacement = _replacement;
if (skipped) return node;
if (removed) return null;
}
for (const key in node) {
const value = node[key];
if (typeof value !== "object") {
continue;
} else if (Array.isArray(value)) {
for (let i = 0; i < value.length; i += 1) {
if (value[i] !== null && typeof value[i].type === 'string') {
if (!this.visit(value[i], node, key, i)) {
// removed
i--;
}
}
}
} else if (value !== null && typeof value.type === "string") {
this.visit(value, node, key, null);
}
}
if (this.leave) {
const _replacement = this.replacement;
const _should_remove = this.should_remove;
this.replacement = null;
this.should_remove = false;
this.leave.call(this.context, node, parent, prop, index);
if (this.replacement) {
node = this.replacement;
this.replace(parent, prop, index, node);
}
if (this.should_remove) {
this.remove(parent, prop, index);
}
const removed = this.should_remove;
this.replacement = _replacement;
this.should_remove = _should_remove;
if (removed) return null;
}
}
return node;
}
}

View File

@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.popNumber = exports.popScheduler = exports.popResultSelector = void 0;
var isFunction_1 = require("./isFunction");
var isScheduler_1 = require("./isScheduler");
function last(arr) {
return arr[arr.length - 1];
}
function popResultSelector(args) {
return isFunction_1.isFunction(last(args)) ? args.pop() : undefined;
}
exports.popResultSelector = popResultSelector;
function popScheduler(args) {
return isScheduler_1.isScheduler(last(args)) ? args.pop() : undefined;
}
exports.popScheduler = popScheduler;
function popNumber(args, defaultValue) {
return typeof last(args) === 'number' ? args.pop() : defaultValue;
}
exports.popNumber = popNumber;
//# sourceMappingURL=args.js.map

View File

@@ -0,0 +1,368 @@
# form-data-encoder
Encode `FormData` content into the `multipart/form-data` format
[![Code Coverage](https://codecov.io/github/octet-stream/form-data-encoder/coverage.svg?branch=master)](https://codecov.io/github/octet-stream/form-data-encoder?branch=master)
[![CI](https://github.com/octet-stream/form-data-encoder/workflows/CI/badge.svg)](https://github.com/octet-stream/form-data-encoder/actions/workflows/ci.yml)
[![ESLint](https://github.com/octet-stream/form-data-encoder/workflows/ESLint/badge.svg)](https://github.com/octet-stream/form-data-encoder/actions/workflows/eslint.yml)
## Requirements
- Node.js v14.17 or higher;
- Runtime should support `TextEncoder`, `TextDecoder`, `WeakMap`, `WeakSet` and async generator functions;
- For TypeScript users: tsc v4.3 or higher.
## Installation
You can install this package using npm:
```sh
npm install form-data-encoder
```
Or yarn:
```sh
yarn add form-data-encoder
```
Or pnpm:
```sh
pnpm add form-data-encoder
```
## Usage
1. To start the encoding process, you need to create a new Encoder instance with the FormData you want to encode:
```js
import {Readable} from "stream"
import {FormData, File} from "formdata-node"
import {FormDataEncoder} from "form-data-encoder"
import fetch from "node-fetch"
const form = new FormData()
form.set("greeting", "Hello, World!")
form.set("file", new File(["On Soviet Moon landscape see binoculars through YOU"], "file.txt"))
const encoder = new FormDataEncoder(form)
const options = {
method: "post",
// Set request headers provided by the Encoder.
// The `headers` property has `Content-Type` and `Content-Length` headers.
headers: encoder.headers,
// Create a Readable stream from the Encoder.
// You can omit usage of `Readable.from` for HTTP clients whose support async iterables in request body.
// The Encoder will yield FormData content portions encoded into the multipart/form-data format as node-fetch consumes the stream.
body: Readable.from(encoder.encode()) // or just Readable.from(encoder)
}
const response = await fetch("https://httpbin.org/post", options)
console.log(await response.json())
```
2. Encoder support different spec-compatible FormData implementations. Let's try it with [`formdata-polyfill`](https://github.com/jimmywarting/FormData):
```js
import {Readable} from "stream"
import {FormDataEncoder} from "form-data-encoder"
import {FormData} from "formdata-polyfill/esm-min.js"
import {File} from "fetch-blob" // v3
const form = new FormData()
form.set("field", "Some value")
form.set("file", new File(["File content goes here"], "file.txt"))
const encoder = new FormDataEncoder(form)
const options = {
method: "post",
headers: encoder.headers,
body: Readable.from(encoder)
}
await fetch("https://httpbin.org/post", options)
```
3. Because the Encoder is iterable (it has both Symbol.asyncIterator and Symbol.iterator methods), you can use it with different targets. Let's say you want to convert FormData content into `Blob`, for that you can write a function like this:
```js
import {Readable} from "stream"
import {FormDataEncoder} from "form-data-encoder"
import {FormData, File, Blob, fileFromPath} from "formdata-node"
import fetch from "node-fetch"
const form = new FormData()
form.set("field", "Just a random string")
form.set("file", new File(["Using files is class amazing"], "file.txt"))
form.set("fileFromPath", await fileFromPath("path/to/a/file.txt"))
// Note 1: When using with native Blob or fetch-blob@2 you might also need to generate boundary string for your FormDataEncoder instance
// because Blob will lowercase value of the `type` option and default boundary generator produces a string with both lower and upper cased alphabetical characters. Math.random() should be enough to fix this:
// const encoder = new FormDataEncoder(form, String(Math.random()))
const encoder = new FormDataEncoder(form)
const options = {
method: "post",
// Note 2: To use this approach with fetch-blob@2 you probably gonna need to convert the encoder parts output to an array first:
// new Blob([...encoder], {type: encoder.contentType})
body: new Blob(encoder, {type: encoder.contentType})
}
const response = await fetch("https://httpbin.org/post", options)
console.log(await response.json())
```
4. Here's FormData to Blob conversion with async-iterator approach:
```js
import {FormData} from "formdata-polyfill/esm-min.js"
import {blobFrom} from "fetch-blob/from.js"
import {FormDataEncoder} from "form-data-encoder"
import Blob from "fetch-blob"
import fetch from "node-fetch"
// This approach may require much more RAM compared to the previous one, but it works too.
async function toBlob(form) {
const encoder = new Encoder(form)
const chunks = []
for await (const chunk of encoder) {
chunks.push(chunk)
}
return new Blob(chunks, {type: encoder.contentType})
}
const form = new FormData()
form.set("name", "John Doe")
form.set("avatar", await blobFrom("path/to/an/avatar.png"), "avatar.png")
const options = {
method: "post",
body: await toBlob(form)
}
await fetch("https://httpbin.org/post", options)
```
5. Another way to convert FormData parts to blob using `form-data-encoder` is making a Blob-ish class:
```js
import {Readable} from "stream"
import {FormDataEncoder} from "form-data-encoder"
import {FormData} from "formdata-polyfill/esm-min.js"
import {blobFrom} from "fetch-blob/from.js"
import Blob from "fetch-blob"
import fetch from "node-fetch"
class BlobDataItem {
constructor(encoder) {
this.#encoder = encoder
this.#size = encoder.headers["Content-Length"]
this.#type = encoder.headers["Content-Type"]
}
get type() {
return this.#type
}
get size() {
return this.#size
}
stream() {
return Readable.from(this.#encoder)
}
get [Symbol.toStringTag]() {
return "Blob"
}
}
const form = new FormData()
form.set("name", "John Doe")
form.set("avatar", await blobFrom("path/to/an/avatar.png"), "avatar.png")
const encoder = new FormDataEncoder(form)
// Note that node-fetch@2 performs more strictness tests for Blob objects, so you may need to do extra steps before you set up request body (like, maybe you'll need to instaniate a Blob with BlobDataItem as one of its blobPart)
const blob = new BlobDataItem(enocoder) // or new Blob([new BlobDataItem(enocoder)], {type: encoder.contentType})
const options = {
method: "post",
body: blob
}
await fetch("https://httpbin.org/post", options)
```
6. In this example we will pull FormData content into the ReadableStream:
```js
// This module is only necessary when you targeting Node.js or need web streams that implement Symbol.asyncIterator
import {ReadableStream} from "web-streams-polyfill/ponyfill/es2018"
import {FormDataEncoder} from "form-data-encoder"
import {FormData} from "formdata-node"
import fetch from "node-fetch"
function toReadableStream(encoder) {
const iterator = encoder.encode()
return new ReadableStream({
async pull(controller) {
const {value, done} = await iterator.next()
if (done) {
return controller.close()
}
controller.enqueue(value)
}
})
}
const form = new FormData()
form.set("field", "My hovercraft is full of eels")
const encoder = new FormDataEncoder(form)
const options = {
method: "post",
headers: encoder.headers,
body: toReadableStream(encoder)
}
// Note that this example requires `fetch` to support Symbol.asyncIterator, which node-fetch lacks of (but will support eventually)
await fetch("https://httpbin.org/post", options)
```
7. Speaking of async iterables - if HTTP client supports them, you can use encoder like this:
```js
import {FormDataEncoder} from "form-data-encoder"
import {FormData} from "formdata-node"
import fetch from "node-fetch"
const form = new FormData()
form.set("field", "My hovercraft is full of eels")
const encoder = new FormDataEncoder(form)
const options = {
method: "post",
headers: encoder.headers,
body: encoder
}
await fetch("https://httpbin.org/post", options)
```
8. ...And for those client whose supporting form-data-encoder out of the box, the usage will be much, much more simpler:
```js
import {FormData} from "formdata-node" // Or any other spec-compatible implementation
import fetch from "node-fetch"
const form = new FormData()
form.set("field", "My hovercraft is full of eels")
const options = {
method: "post",
body: form
}
// Note that node-fetch does NOT support form-data-encoder
await fetch("https://httpbin.org/post", options)
```
## API
### `class FormDataEncoder`
##### `constructor(form[, boundary, options]) -> {FormDataEncoder}`
- **{FormDataLike}** form - FormData object to encode. This object must be a spec-compatible FormData implementation.
- **{string}** [boundary] - An optional boundary string that will be used by the encoder. If there's no boundary string is present, FormDataEncoder will generate it automatically.
- **{object}** [options] - FormDataEncoder options.
- **{boolean}** [options.enableAdditionalHeaders = false] - When enabled, the encoder will emit additional per part headers, such as `Content-Length`. Please note that the web clients do not include these, so when enabled this option might cause an error if `multipart/form-data` does not consider additional headers.
Creates a `multipart/form-data` encoder.
#### Instance properties
##### `boundary -> {string}`
Returns boundary string.
##### `contentType -> {string}`
Returns Content-Type header.
##### `contentLength -> {string}`
Return Content-Length header.
##### `headers -> {object}`
Returns headers object with Content-Type and Content-Length header.
#### Instance methods
##### `values() -> {Generator<Uint8Array | FileLike, void, undefined>}`
Creates an iterator allowing to go through form-data parts (with metadata).
This method **will not** read the files.
##### `encode() -> {AsyncGenerator<Uint8Array, void, undefined>}`
Creates an async iterator allowing to perform the encoding by portions.
This method **will** also read files.
##### `[Symbol.iterator]() -> {Generator<Uint8Array | FileLike, void, undefined>}`
An alias for `Encoder#values()` method.
##### `[Symbol.asyncIterator]() -> {AsyncGenerator<Uint8Array, void, undefined>}`
An alias for `Encoder#encode()` method.
### `isFile(value) -> {boolean}`
Check if a value is File-ish object.
- **{unknown}** value - a value to test
### `isFormData(value) -> {boolean}`
Check if a value is FormData-ish object.
- **{unknown}** value - a value to test