v26.1.40 is released
This commit is contained in:
Родитель
5e590d2585
Коммит
8d3af07aa9
|
@ -2,6 +2,14 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### Checkbox
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I602047` - The issue with "CheckBox change event triggered twice when setting label as HTML string element" has been resolved.
|
||||
|
||||
## 26.1.35 (2024-06-11)
|
||||
|
||||
### Switch
|
||||
|
|
6
components/buttons/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
6
components/buttons/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
|
@ -1,6 +1,6 @@
|
|||
# 🎭 Playwright
|
||||
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-125.0.6422.26-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-125.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-127.0.6533.17-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-127.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 17 Jun 2024 23:07:28 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1643.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1648.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
103
components/buttons/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/buttons/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
103
components/buttons/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/buttons/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
2
components/buttons/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
2
components/buttons/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
148
components/buttons/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/buttons/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
|
@ -1,6 +1,6 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
A robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms.
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
|
@ -10,26 +10,60 @@ This JavaScript library is the result of comparing, optimizing and documenting d
|
|||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
Via [npm](https://www.npmjs.com/) (only required for Node.js releases older than v0.6.2):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
npm install punycode
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
Via [Bower](http://bower.io/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
```bash
|
||||
bower install punycode
|
||||
```
|
||||
|
||||
Via [Component](https://github.com/component/component):
|
||||
|
||||
```bash
|
||||
component install bestiejs/punycode.js
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="punycode.js"></script>
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
var punycode = require('punycode');
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('punycode.js');
|
||||
```
|
||||
|
||||
Using an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(
|
||||
{
|
||||
'paths': {
|
||||
'punycode': 'path/to/punycode'
|
||||
}
|
||||
},
|
||||
['punycode'],
|
||||
function(punycode) {
|
||||
console.log(punycode);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
@ -115,27 +149,15 @@ punycode.ucs2.encode([0x1D306]);
|
|||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
## Unit tests & code coverage
|
||||
|
||||
### How to publish a new release
|
||||
After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -143,6 +165,12 @@ A string representing the current Punycode.js version number.
|
|||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
||||
|
|
103
components/buttons/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/buttons/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
148
components/buttons/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/buttons/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
148
components/buttons/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/buttons/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
6
components/calendars/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
6
components/calendars/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
|
@ -1,6 +1,6 @@
|
|||
# 🎭 Playwright
|
||||
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-125.0.6422.26-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-125.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-127.0.6533.17-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-127.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
|
|
|
@ -201,6 +201,19 @@ The [JavaScript Rating](https://www.syncfusion.com/javascript-ui-controls/js-rat
|
|||
* [Appearance](https://ej2.syncfusion.com/documentation/rating/appearance) - Customize the rating items appearance.
|
||||
* [Templates](https://ej2.syncfusion.com/documentation/rating/templates) - Customize the rating item with a heart, SVG, or any content that precisely matches unique needs.
|
||||
|
||||
### JavaScript OTP Input
|
||||
|
||||
The `JavaScript OTP Input` control is designed to securely enter and verify single-use passwords for multi-factor authentication purposes in various applications, such as banking, e-commerce, or account login processes. It has several built-in features such as support for input types, styling modes, placeholder, seperators, and customization.
|
||||
|
||||
#### Key features
|
||||
|
||||
* `Input types` - Allow specifying the input type as text, number, or password for the OTP input..
|
||||
* `Styling modes` - Offer built-in styling options such as underline, outline, or fill.
|
||||
* `Tooltip` - Displays additional information of the rating items.
|
||||
* `Placeholders` - Allow setting a hint character for each input field, indicating the expected value.
|
||||
* `Separators` - Specify a character to be placed between input fields.
|
||||
* `Customization` - Allows customizing the default appearance, including input field styling, input length, and more.
|
||||
|
||||
<p align="center">
|
||||
Trusted by the world's leading companies
|
||||
<a href="https://www.syncfusion.com/">
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Mon, 03 Jun 2024 23:35:49 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for validator (https://github.com/validat
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/validator.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 11 May 2024 09:35:43 GMT
|
||||
* Last updated: Sun, 16 Jun 2024 11:35:49 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
|
|
282
components/calendars/node_modules/acorn-walk/node_modules/acorn/README.md
сгенерированный
поставляемый
Normal file
282
components/calendars/node_modules/acorn-walk/node_modules/acorn/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,282 @@
|
|||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` must be an object setting
|
||||
some of the options listed below. The return value will be an abstract
|
||||
syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options are provided by in a second argument, which should be an
|
||||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
implemented through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed,
|
||||
and also allows `import.meta` expressions to appear in scripts
|
||||
(when `sourceType` is not `"module"`).
|
||||
|
||||
- **allowAwaitOutsideFunction**: If `false`, `await` expressions can
|
||||
only appear inside `async` functions. Defaults to `true` in modules
|
||||
for `ecmaVersion` 2022 and later, `false` for lower versions.
|
||||
Setting this option to `true` allows to have top-level `await`
|
||||
expressions. They are still not allowed in non-`async` functions,
|
||||
though.
|
||||
|
||||
- **allowSuperOutsideMethod**: By default, `super` outside a method
|
||||
raises an error. Set this to `true` to accept such code.
|
||||
|
||||
- **allowHashBang**: When this is enabled, if the code starts with the
|
||||
characters `#!` (as in a shellscript), the first line will be
|
||||
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
|
||||
|
||||
- **checkPrivateFields**: By default, the parser will verify that
|
||||
private properties are only used in places where they are valid and
|
||||
have been declared. Set this to false to turn such checks off.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
Note that tokenizing JavaScript without parsing it is, in modern
|
||||
versions of the language, not really possible due to the way syntax is
|
||||
overloaded in ways that can only be disambiguated by the parse
|
||||
context. This package applies a bunch of heuristics to try and do a
|
||||
reasonable job, but you are advised to use `parse` with the `onToken`
|
||||
option instead of this.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--allow-await-outside-function`: Allows top-level `await` expressions.
|
||||
See the `allowAwaitOutsideFunction` option for more information.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1633.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1649.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
103
components/calendars/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/calendars/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
103
components/calendars/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/calendars/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
# fast-uri
|
||||
|
||||
<div align="center">
|
||||
|
||||
[![CI](https://github.com/fastify/fast-uri/actions/workflows/ci.yml/badge.svg)](https://github.com/fastify/fast-uri/actions/workflows/ci.yml)
|
||||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
|
||||
|
||||
</div>
|
||||
|
||||
Dependency free RFC 3986 URI toolbox.
|
||||
|
||||
## Usage
|
||||
|
||||
## Options
|
||||
|
||||
All of the above functions can accept an additional options argument that is an object that can contain one or more of the following properties:
|
||||
|
||||
* `scheme` (string)
|
||||
Indicates the scheme that the URI should be treated as, overriding the URI's normal scheme parsing behavior.
|
||||
|
||||
* `reference` (string)
|
||||
If set to `"suffix"`, it indicates that the URI is in the suffix format and the parser will use the option's `scheme` property to determine the URI's scheme.
|
||||
|
||||
* `tolerant` (boolean, false)
|
||||
If set to `true`, the parser will relax URI resolving rules.
|
||||
|
||||
* `absolutePath` (boolean, false)
|
||||
If set to `true`, the serializer will not resolve a relative `path` component.
|
||||
|
||||
* `unicodeSupport` (boolean, false)
|
||||
If set to `true`, the parser will unescape non-ASCII characters in the parsed output as per [RFC 3987](http://www.ietf.org/rfc/rfc3987.txt).
|
||||
|
||||
* `domainHost` (boolean, false)
|
||||
If set to `true`, the library will treat the `host` component as a domain name, and convert IDNs (International Domain Names) as per [RFC 5891](http://www.ietf.org/rfc/rfc5891.txt).
|
||||
|
||||
### Parse
|
||||
|
||||
```js
|
||||
const uri = require('fast-uri')
|
||||
uri.parse('uri://user:pass@example.com:123/one/two.three?q1=a1&q2=a2#body')
|
||||
// Output
|
||||
{
|
||||
scheme : "uri",
|
||||
userinfo : "user:pass",
|
||||
host : "example.com",
|
||||
port : 123,
|
||||
path : "/one/two.three",
|
||||
query : "q1=a1&q2=a2",
|
||||
fragment : "body"
|
||||
}
|
||||
```
|
||||
|
||||
### Serialize
|
||||
|
||||
```js
|
||||
const uri = require('fast-uri')
|
||||
uri.serialize({scheme : "http", host : "example.com", fragment : "footer"})
|
||||
// Output
|
||||
"http://example.com/#footer"
|
||||
|
||||
```
|
||||
|
||||
### Resolve
|
||||
|
||||
```js
|
||||
const uri = require('fast-uri')
|
||||
uri.resolve("uri://a/b/c/d?q", "../../g")
|
||||
// Output
|
||||
"uri://a/g"
|
||||
```
|
||||
|
||||
### Equal
|
||||
|
||||
```js
|
||||
const uri = require('fast-uri')
|
||||
uri.equal("example://a/b/c/%7Bfoo%7D", "eXAMPLE://a/./b/../b/%63/%7bfoo%7d")
|
||||
// Output
|
||||
true
|
||||
```
|
||||
|
||||
## Scheme supports
|
||||
|
||||
fast-uri supports inserting custom [scheme](http://en.wikipedia.org/wiki/URI_scheme) dependent processing rules. Currently, fast-uri has built in support for the following schemes:
|
||||
|
||||
* http \[[RFC 2616](http://www.ietf.org/rfc/rfc2616.txt)\]
|
||||
* https \[[RFC 2818](http://www.ietf.org/rfc/rfc2818.txt)\]
|
||||
* ws \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
|
||||
* wss \[[RFC 6455](http://www.ietf.org/rfc/rfc6455.txt)\]
|
||||
* urn \[[RFC 2141](http://www.ietf.org/rfc/rfc2141.txt)\]
|
||||
* urn:uuid \[[RFC 4122](http://www.ietf.org/rfc/rfc4122.txt)\]
|
||||
|
||||
|
||||
## Benchmarks
|
||||
|
||||
```
|
||||
fast-uri: parse domain x 1,306,864 ops/sec ±0.31% (100 runs sampled)
|
||||
urijs: parse domain x 483,001 ops/sec ±0.09% (99 runs sampled)
|
||||
WHATWG URL: parse domain x 862,461 ops/sec ±0.18% (97 runs sampled)
|
||||
fast-uri: parse IPv4 x 2,381,452 ops/sec ±0.26% (96 runs sampled)
|
||||
urijs: parse IPv4 x 384,705 ops/sec ±0.34% (99 runs sampled)
|
||||
WHATWG URL: parse IPv4 NOT SUPPORTED
|
||||
fast-uri: parse IPv6 x 923,519 ops/sec ±0.09% (100 runs sampled)
|
||||
urijs: parse IPv6 x 289,070 ops/sec ±0.07% (95 runs sampled)
|
||||
WHATWG URL: parse IPv6 NOT SUPPORTED
|
||||
fast-uri: parse URN x 2,596,395 ops/sec ±0.42% (98 runs sampled)
|
||||
urijs: parse URN x 1,152,412 ops/sec ±0.09% (97 runs sampled)
|
||||
WHATWG URL: parse URN x 1,183,307 ops/sec ±0.38% (100 runs sampled)
|
||||
fast-uri: parse URN uuid x 1,666,861 ops/sec ±0.10% (98 runs sampled)
|
||||
urijs: parse URN uuid x 852,724 ops/sec ±0.17% (95 runs sampled)
|
||||
WHATWG URL: parse URN uuid NOT SUPPORTED
|
||||
fast-uri: serialize uri x 1,741,499 ops/sec ±0.57% (95 runs sampled)
|
||||
urijs: serialize uri x 389,014 ops/sec ±0.28% (93 runs sampled)
|
||||
fast-uri: serialize IPv6 x 441,095 ops/sec ±0.37% (97 runs sampled)
|
||||
urijs: serialize IPv6 x 255,443 ops/sec ±0.58% (94 runs sampled)
|
||||
fast-uri: serialize ws x 1,448,667 ops/sec ±0.25% (97 runs sampled)
|
||||
urijs: serialize ws x 352,884 ops/sec ±0.08% (96 runs sampled)
|
||||
fast-uri: resolve x 340,084 ops/sec ±0.98% (98 runs sampled)
|
||||
urijs: resolve x 225,759 ops/sec ±0.37% (95 runs sampled)
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
- [ ] Support MailTo
|
||||
- [ ] Be 100% iso compatible with uri-js
|
||||
- [ ] Add browser test stack
|
|
@ -88,3 +88,41 @@ status code rather than reporting the signal properly. This
|
|||
module tries to do the right thing, but on Windows systems, you
|
||||
may see that incorrect result. There is as far as I'm aware no
|
||||
workaround for this.
|
||||
|
||||
## util: `foreground-child/proxy-signals`
|
||||
|
||||
If you just want to proxy the signals to a child process that the
|
||||
main process receives, you can use the `proxy-signals` export
|
||||
from this package.
|
||||
|
||||
```js
|
||||
import { proxySignals } from 'foreground-child/proxy-signals'
|
||||
|
||||
const childProcess = spawn('command', ['some', 'args'])
|
||||
proxySignals(childProcess)
|
||||
```
|
||||
|
||||
Now, any fatal signal received by the current process will be
|
||||
proxied to the child process.
|
||||
|
||||
It doesn't go in the other direction; ie, signals sent to the
|
||||
child process will not affect the parent. For that, listen to the
|
||||
child `exit` or `close` events, and handle them appropriately.
|
||||
|
||||
## util: `foreground-child/watchdog`
|
||||
|
||||
If you are spawning a child process, and want to ensure that it
|
||||
isn't left dangling if the parent process exits, you can use the
|
||||
watchdog utility exported by this module.
|
||||
|
||||
```js
|
||||
import { watchdog } from 'foreground-child/watchdog'
|
||||
|
||||
const childProcess = spawn('command', ['some', 'args'])
|
||||
const watchdogProcess = watchdog(childProcess)
|
||||
|
||||
// watchdogProcess is a reference to the process monitoring the
|
||||
// parent and child. There's usually no reason to do anything
|
||||
// with it, as it's silent and will terminate
|
||||
// automatically when it's no longer needed.
|
||||
```
|
||||
|
|
2
components/calendars/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
2
components/calendars/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
11
components/calendars/node_modules/karma-typescript/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/calendars/node_modules/karma-typescript/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
148
components/calendars/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/calendars/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
|
@ -1,6 +1,6 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
A robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms.
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
|
@ -10,26 +10,60 @@ This JavaScript library is the result of comparing, optimizing and documenting d
|
|||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
Via [npm](https://www.npmjs.com/) (only required for Node.js releases older than v0.6.2):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
npm install punycode
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
Via [Bower](http://bower.io/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
```bash
|
||||
bower install punycode
|
||||
```
|
||||
|
||||
Via [Component](https://github.com/component/component):
|
||||
|
||||
```bash
|
||||
component install bestiejs/punycode.js
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="punycode.js"></script>
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
var punycode = require('punycode');
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('punycode.js');
|
||||
```
|
||||
|
||||
Using an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(
|
||||
{
|
||||
'paths': {
|
||||
'punycode': 'path/to/punycode'
|
||||
}
|
||||
},
|
||||
['punycode'],
|
||||
function(punycode) {
|
||||
console.log(punycode);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
@ -115,27 +149,15 @@ punycode.ucs2.encode([0x1D306]);
|
|||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
## Unit tests & code coverage
|
||||
|
||||
### How to publish a new release
|
||||
After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -143,6 +165,12 @@ A string representing the current Punycode.js version number.
|
|||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
||||
|
|
103
components/calendars/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/calendars/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
11
components/calendars/node_modules/terser/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/calendars/node_modules/terser/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
148
components/calendars/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/calendars/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
148
components/calendars/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/calendars/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
11
components/calendars/node_modules/webpack/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/calendars/node_modules/webpack/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-calendars",
|
||||
"version": "18.32.5",
|
||||
"version": "26.1.38",
|
||||
"description": "A complete package of date or time components with built-in features such as date formatting, inline editing, multiple (range) selection, range restriction, month and year selection, strict mode, and globalization. for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### Chart
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I604532` - Removed exclamation mark from comments in the chart source.
|
||||
|
||||
## 26.1.39 (2024-06-25)
|
||||
|
||||
### Chart
|
||||
|
|
6
components/charts/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
6
components/charts/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
|
@ -1,6 +1,6 @@
|
|||
# 🎭 Playwright
|
||||
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-125.0.6422.26-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-125.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-127.0.6533.17-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-127.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 22 Jun 2024 07:35:32 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1646.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1651.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
895
components/charts/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
895
components/charts/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
|
@ -102,888 +102,8 @@ cache.clear() // empty the cache
|
|||
If you put more stuff in the cache, then less recently used items
|
||||
will fall out. That's what an LRU cache is.
|
||||
|
||||
## `class LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new `LRUCache` object.
|
||||
|
||||
When using TypeScript, set the `K` and `V` types to the `key` and
|
||||
`value` types, respectively.
|
||||
|
||||
The `FC` ("fetch context") generic type defaults to `unknown`.
|
||||
If set to a value other than `void` or `undefined`, then any
|
||||
calls to `cache.fetch()` _must_ provide a `context` option
|
||||
matching the `FC` type. If `FC` is set to `void` or `undefined`,
|
||||
then `cache.fetch()` _must not_ provide a `context` option. See
|
||||
the documentation on `async fetch()` below.
|
||||
|
||||
## Options
|
||||
|
||||
All options are available on the LRUCache instance, making it
|
||||
safe to pass an LRUCache instance as the options argument to make
|
||||
another empty cache of the same type.
|
||||
|
||||
Some options are marked read-only because changing them after
|
||||
instantiation is not safe. Changing any of the other options
|
||||
will of course only have an effect on subsequent method calls.
|
||||
|
||||
### `max` (read only)
|
||||
|
||||
The maximum number of items that remain in the cache (assuming no
|
||||
TTL pruning or explicit deletions). Note that fewer items may be
|
||||
stored if size calculation is used, and `maxSize` is exceeded.
|
||||
This must be a positive finite intger.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
**It is strongly recommended to set a `max` to prevent unbounded
|
||||
growth of the cache.** See "Storage Bounds Safety" below.
|
||||
|
||||
### `maxSize` (read only)
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and automatically evict items in order to stay below
|
||||
this size. Note that this may result in fewer than `max` items
|
||||
being stored.
|
||||
|
||||
Attempting to add an item to the cache whose calculated size is
|
||||
greater that this amount will be a no-op. The item will not be
|
||||
cached, and no other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided.
|
||||
|
||||
Sets `maxEntrySize` to the same value, unless a different value
|
||||
is provided for `maxEntrySize`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if size tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
### `maxEntrySize`
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and prevent caching any item over a given size.
|
||||
Attempting to add an item whose calculated size is greater than
|
||||
this amount will be a no-op. The item will not be cached, and no
|
||||
other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided. Defaults to
|
||||
the value of `maxSize` if provided.
|
||||
|
||||
### `sizeCalculation`
|
||||
|
||||
Function used to calculate the size of stored items. If you're
|
||||
storing strings or buffers, then you probably want to do
|
||||
something like `n => n.length`. The item is passed as the first
|
||||
argument, and the key is passed as the second argument.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Requires `maxSize` to be set.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
### `fetchMethod` (read only)
|
||||
|
||||
Function that is used to make background asynchronous fetches.
|
||||
Called with `fetchMethod(key, staleValue, { signal, options,
|
||||
context })`. May return a Promise.
|
||||
|
||||
If `fetchMethod` is not provided, then `cache.fetch(key)` is
|
||||
equivalent to `Promise.resolve(cache.get(key))`.
|
||||
|
||||
If at any time, `signal.aborted` is set to `true`, or if the
|
||||
`signal.onabort` method is called, or if it emits an `'abort'`
|
||||
event which you can listen to with `addEventListener`, then that
|
||||
means that the fetch should be abandoned. This may be passed
|
||||
along to async functions aware of AbortController/AbortSignal
|
||||
behavior.
|
||||
|
||||
The `fetchMethod` should **only** return `undefined` or a Promise
|
||||
resolving to `undefined` if the AbortController signaled an
|
||||
`abort` event. In all other cases, it should return or resolve
|
||||
to a value suitable for adding to the cache.
|
||||
|
||||
The `options` object is a union of the options that may be
|
||||
provided to `set()` and `get()`. If they are modified, then that
|
||||
will result in modifying the settings to `cache.set()` when the
|
||||
value is resolved, and in the case of `noDeleteOnFetchRejection`
|
||||
and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
|
||||
failures.
|
||||
|
||||
For example, a DNS cache may update the TTL based on the value
|
||||
returned from a remote DNS server by changing `options.ttl` in
|
||||
the `fetchMethod`.
|
||||
|
||||
### `noDeleteOnFetchRejection`
|
||||
|
||||
If a `fetchMethod` throws an error or returns a rejected promise,
|
||||
then by default, any existing stale value will be removed from
|
||||
the cache.
|
||||
|
||||
If `noDeleteOnFetchRejection` is set to `true`, then this
|
||||
behavior is suppressed, and the stale value remains in the cache
|
||||
in the case of a rejected `fetchMethod`.
|
||||
|
||||
This is important in cases where a `fetchMethod` is _only_ called
|
||||
as a background update while the stale value is returned, when
|
||||
`allowStale` is used.
|
||||
|
||||
This is implicitly in effect when `allowStaleOnFetchRejection` is
|
||||
set.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchRejection`
|
||||
|
||||
Set to true to return a stale value from the cache when a
|
||||
`fetchMethod` throws an error or returns a rejected Promise.
|
||||
|
||||
If a `fetchMethod` fails, and there is no stale value available,
|
||||
the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
|
||||
errors are suppressed.
|
||||
|
||||
Implies `noDeleteOnFetchRejection`.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchAbort`
|
||||
|
||||
Set to true to return a stale value from the cache when the
|
||||
`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
|
||||
event, whether user-triggered, or due to internal cache behavior.
|
||||
|
||||
Unless `ignoreFetchAbort` is also set, the underlying
|
||||
`fetchMethod` will still be considered canceled, and any value
|
||||
it returns will be ignored and not cached.
|
||||
|
||||
Caveat: since fetches are aborted when a new value is explicitly
|
||||
set in the cache, this can lead to fetch returning a stale value,
|
||||
since that was the fallback value _at the moment the `fetch()` was
|
||||
initiated_, even though the new updated value is now present in
|
||||
the cache.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const cache = new LRUCache<string, any>({
|
||||
ttl: 100,
|
||||
fetchMethod: async (url, oldValue, { signal }) => {
|
||||
const res = await fetch(url, { signal })
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
cache.set('https://example.com/', { some: 'data' })
|
||||
// 100ms go by...
|
||||
const result = cache.fetch('https://example.com/')
|
||||
cache.set('https://example.com/', { other: 'thing' })
|
||||
console.log(await result) // { some: 'data' }
|
||||
console.log(cache.get('https://example.com/')) // { other: 'thing' }
|
||||
```
|
||||
|
||||
### `ignoreFetchAbort`
|
||||
|
||||
Set to true to ignore the `abort` event emitted by the
|
||||
`AbortSignal` object passed to `fetchMethod`, and still cache the
|
||||
resulting resolution value, as long as it is not `undefined`.
|
||||
|
||||
When used on its own, this means aborted `fetch()` calls are not
|
||||
immediately resolved or rejected when they are aborted, and
|
||||
instead take the full time to await.
|
||||
|
||||
When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
|
||||
will resolve immediately to their stale cached value or
|
||||
`undefined`, and will continue to process and eventually update
|
||||
the cache when they resolve, as long as the resulting value is
|
||||
not `undefined`, thus supporting a "return stale on timeout while
|
||||
refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
|
||||
signal.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const c = new LRUCache({
|
||||
ttl: 100,
|
||||
ignoreFetchAbort: true,
|
||||
allowStaleOnFetchAbort: true,
|
||||
fetchMethod: async (key, oldValue, { signal }) => {
|
||||
// note: do NOT pass the signal to fetch()!
|
||||
// let's say this fetch can take a long time.
|
||||
const res = await fetch(`https://slow-backend-server/${key}`)
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
// this will return the stale value after 100ms, while still
|
||||
// updating in the background for next time.
|
||||
const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
|
||||
```
|
||||
|
||||
**Note**: regardless of this setting, an `abort` event _is still
|
||||
emitted on the `AbortSignal` object_, so may result in invalid
|
||||
results when passed to other underlying APIs that use
|
||||
AbortSignals.
|
||||
|
||||
This may be overridden on the `fetch()` call or in the
|
||||
`fetchMethod` itself.
|
||||
|
||||
### `dispose` (read only)
|
||||
|
||||
Function that is called on items when they are dropped from the
|
||||
cache, as `this.dispose(value, key, reason)`.
|
||||
|
||||
This can be handy if you want to close file descriptors or do
|
||||
other cleanup tasks when items are no longer stored in the cache.
|
||||
|
||||
**NOTE**: It is called _before_ the item has been fully removed
|
||||
from the cache, so if you want to put it right back in, you need
|
||||
to wait until the next tick. If you try to add it back in during
|
||||
the `dispose()` function call, it will break things in subtle and
|
||||
weird ways.
|
||||
|
||||
Unlike several other options, this may _not_ be overridden by
|
||||
passing an option to `set()`, for performance reasons.
|
||||
|
||||
The `reason` will be one of the following strings, corresponding
|
||||
to the reason for the item's deletion:
|
||||
|
||||
- `evict` Item was evicted to make space for a new addition
|
||||
- `set` Item was overwritten by a new value
|
||||
- `delete` Item was removed by explicit `cache.delete(key)` or by
|
||||
calling `cache.clear()`, which deletes everything.
|
||||
|
||||
The `dispose()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
Optional, must be a function.
|
||||
|
||||
### `disposeAfter` (read only)
|
||||
|
||||
The same as `dispose`, but called _after_ the entry is completely
|
||||
removed and the cache is once again in a clean state.
|
||||
|
||||
It is safe to add an item right back into the cache at this
|
||||
point. However, note that it is _very_ easy to inadvertently
|
||||
create infinite recursion in this way.
|
||||
|
||||
The `disposeAfter()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
### `noDisposeOnSet`
|
||||
|
||||
Set to `true` to suppress calling the `dispose()` function if the
|
||||
entry key is still accessible within the cache.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Boolean, default `false`. Only relevant if `dispose` or
|
||||
`disposeAfter` options are set.
|
||||
|
||||
### `ttl`
|
||||
|
||||
Max time to live for items before they are considered stale.
|
||||
Note that stale items are NOT preemptively removed by default,
|
||||
and MAY live in the cache, contributing to its LRU max, long
|
||||
after they have expired.
|
||||
|
||||
Also, as this cache is optimized for LRU/MRU operations, some of
|
||||
the staleness/TTL checks will reduce performance.
|
||||
|
||||
This is not primarily a TTL cache, and does not make strong TTL
|
||||
guarantees. There is no pre-emptive pruning of expired items,
|
||||
but you _may_ set a TTL on the cache, and it will treat expired
|
||||
items as missing when they are fetched, and delete them.
|
||||
|
||||
Optional, but must be a positive integer in ms if specified.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if ttl tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
If ttl tracking is enabled, and `max` and `maxSize` are not set,
|
||||
and `ttlAutopurge` is not set, then a warning will be emitted
|
||||
cautioning about the potential for unbounded memory consumption.
|
||||
(The TypeScript definitions will also discourage this.)
|
||||
|
||||
### `noUpdateTTL`
|
||||
|
||||
Boolean flag to tell the cache to not update the TTL when setting
|
||||
a new value for an existing key (ie, when updating a value rather
|
||||
than inserting a new value). Note that the TTL value is _always_
|
||||
set (if provided) when adding a new entry into the cache.
|
||||
|
||||
This may be passed as an option to `cache.set()`.
|
||||
|
||||
Boolean, default false.
|
||||
|
||||
### `ttlResolution`
|
||||
|
||||
Minimum amount of time in ms in which to check for staleness.
|
||||
Defaults to `1`, which means that the current time is checked at
|
||||
most once per millisecond.
|
||||
|
||||
Set to `0` to check the current time every time staleness is
|
||||
tested.
|
||||
|
||||
Note that setting this to a higher value _will_ improve
|
||||
performance somewhat while using ttl tracking, albeit at the
|
||||
expense of keeping stale items around a bit longer than intended.
|
||||
|
||||
### `ttlAutopurge`
|
||||
|
||||
Preemptively remove stale items from the cache.
|
||||
|
||||
Note that this may _significantly_ degrade performance,
|
||||
especially if the cache is storing a large number of items. It
|
||||
is almost always best to just leave the stale items in the cache,
|
||||
and let them fall out as new items are added.
|
||||
|
||||
Note that this means that `allowStale` is a bit pointless, as
|
||||
stale items will be deleted almost as soon as they expire.
|
||||
|
||||
Use with caution!
|
||||
|
||||
Boolean, default `false`
|
||||
|
||||
### `allowStale`
|
||||
|
||||
By default, if you set `ttl`, it'll only delete stale items from
|
||||
the cache when you `get(key)`. That is, it's not preemptively
|
||||
pruning items.
|
||||
|
||||
If you set `allowStale:true`, it'll return the stale value as
|
||||
well as deleting it. If you don't set this, then it'll return
|
||||
`undefined` when you try to get a stale entry.
|
||||
|
||||
Note that when a stale entry is fetched, _even if it is returned
|
||||
due to `allowStale` being set_, it is removed from the cache
|
||||
immediately. You can immediately put it back in the cache if you
|
||||
wish, thus resetting the TTL.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`. The `cache.has()` method will always return
|
||||
`false` for stale items.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `noDeleteOnStaleGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, by default stale
|
||||
items will be removed from the cache when the key is accessed
|
||||
with `cache.get()`.
|
||||
|
||||
Setting `noDeleteOnStaleGet` to `true` will cause stale items to
|
||||
remain in the cache, until they are explicitly deleted with
|
||||
`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
|
||||
to `false`.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever it is
|
||||
retrieved from cache with `get()`, causing it to not expire. (It
|
||||
can still fall out of cache based on recency of use, of course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnHas`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever its presence
|
||||
in the cache is checked with `has()`, causing it to not expire.
|
||||
(It can still fall out of cache based on recency of use, of
|
||||
course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.has()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
## API
|
||||
|
||||
### `new LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new LRUCache. All options are documented above, and are
|
||||
on the cache as public members.
|
||||
|
||||
The `K` and `V` types define the key and value types,
|
||||
respectively. The optional `FC` type defines the type of the
|
||||
`context` object passed to `cache.fetch()`.
|
||||
|
||||
Keys and values **must not** be `null` or `undefined`.
|
||||
|
||||
### `cache.max`, `cache.maxSize`, `cache.allowStale`,
|
||||
|
||||
`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
|
||||
`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
|
||||
`cache.updateAgeOnHas`
|
||||
|
||||
All option names are exposed as public members on the cache
|
||||
object.
|
||||
|
||||
These are intended for read access only. Changing them during
|
||||
program operation can cause undefined behavior.
|
||||
|
||||
### `cache.size`
|
||||
|
||||
The total number of items held in the cache at the current
|
||||
moment.
|
||||
|
||||
### `cache.calculatedSize`
|
||||
|
||||
The total size of items in cache when using size tracking.
|
||||
|
||||
### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
|
||||
|
||||
Add a value to the cache.
|
||||
|
||||
Optional options object may contain `ttl` and `sizeCalculation`
|
||||
as described above, which default to the settings on the cache
|
||||
object.
|
||||
|
||||
If `start` is provided, then that will set the effective start
|
||||
time for the TTL calculation. Note that this must be a previous
|
||||
value of `performance.now()` if supported, or a previous value of
|
||||
`Date.now()` if not.
|
||||
|
||||
Options object may also include `size`, which will prevent
|
||||
calling the `sizeCalculation` function and just use the specified
|
||||
number if it is a positive integer, and `noDisposeOnSet` which
|
||||
will prevent calling a `dispose` function in the case of
|
||||
overwrites.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
Will update the recency of the entry.
|
||||
|
||||
Returns the cache object.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
If the value is `undefined`, then this is an alias for
|
||||
`cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
See **Storing Undefined Values** below.
|
||||
|
||||
### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
|
||||
|
||||
Return a value from the cache.
|
||||
|
||||
Will update the recency of the cache entry found.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `info(key) => Entry | undefined`
|
||||
|
||||
Return an `Entry` object containing the currently cached value,
|
||||
as well as ttl and size information if available. Returns
|
||||
undefined if the key is not found in the cache.
|
||||
|
||||
Unlike `dump()` (which is designed to be portable and survive
|
||||
serialization), the `start` value is always the current
|
||||
timestamp, and the `ttl` is a calculated remaining time to live
|
||||
(negative if expired).
|
||||
|
||||
Note that stale values are always returned, rather than being
|
||||
pruned and treated as if they were not in the cache. If you wish
|
||||
to exclude stale entries, guard against a negative `ttl` value.
|
||||
|
||||
### `async fetch(key, options = {}) => Promise`
|
||||
|
||||
The following options are supported:
|
||||
|
||||
- `updateAgeOnGet`
|
||||
- `allowStale`
|
||||
- `size`
|
||||
- `sizeCalculation`
|
||||
- `ttl`
|
||||
- `noDisposeOnSet`
|
||||
- `forceRefresh`
|
||||
- `status` - See **Status Tracking** below.
|
||||
- `signal` - AbortSignal can be used to cancel the `fetch()`.
|
||||
Note that the `signal` option provided to the `fetchMethod` is
|
||||
a different object, because it must also respond to internal
|
||||
cache state changes, but aborting this signal will abort the
|
||||
one passed to `fetchMethod` as well.
|
||||
- `context` - sets the `context` option passed to the underlying
|
||||
`fetchMethod`.
|
||||
|
||||
If the value is in the cache and not stale, then the returned
|
||||
Promise resolves to the value.
|
||||
|
||||
If not in the cache, or beyond its TTL staleness, then
|
||||
`fetchMethod(key, staleValue, { options, signal, context })` is
|
||||
called, and the value returned will be added to the cache once
|
||||
resolved.
|
||||
|
||||
If called with `allowStale`, and an asynchronous fetch is
|
||||
currently in progress to reload a stale value, then the former
|
||||
stale value will be returned.
|
||||
|
||||
If called with `forceRefresh`, then the cached item will be
|
||||
re-fetched, even if it is not stale. However, if `allowStale` is
|
||||
set, then the old value will still be returned. This is useful
|
||||
in cases where you want to force a reload of a cached value. If
|
||||
a background fetch is already in progress, then `forceRefresh`
|
||||
has no effect.
|
||||
|
||||
Multiple fetches for the same `key` will only call `fetchMethod`
|
||||
a single time, and all will be resolved when the value is
|
||||
resolved, even if different options are used.
|
||||
|
||||
If `fetchMethod` is not specified, then this is effectively an
|
||||
alias for `Promise.resolve(cache.get(key))`.
|
||||
|
||||
When the fetch method resolves to a value, if the fetch has not
|
||||
been aborted due to deletion, eviction, or being overwritten,
|
||||
then it is added to the cache using the options provided.
|
||||
|
||||
If the key is evicted or deleted before the `fetchMethod`
|
||||
resolves, then the AbortSignal passed to the `fetchMethod` will
|
||||
receive an `abort` event, and the promise returned by `fetch()`
|
||||
will reject with the reason for the abort.
|
||||
|
||||
If a `signal` is passed to the `fetch()` call, then aborting the
|
||||
signal will abort the fetch and cause the `fetch()` promise to
|
||||
reject with the reason provided.
|
||||
|
||||
#### Setting `context`
|
||||
|
||||
If an `FC` type is set to a type other than `unknown`, `void`, or
|
||||
`undefined` in the LRUCache constructor, then all
|
||||
calls to `cache.fetch()` _must_ provide a `context` option. If
|
||||
set to `undefined` or `void`, then calls to fetch _must not_
|
||||
provide a `context` option.
|
||||
|
||||
The `context` param allows you to provide arbitrary data that
|
||||
might be relevant in the course of fetching the data. It is only
|
||||
relevant for the course of a single `fetch()` operation, and
|
||||
discarded afterwards.
|
||||
|
||||
#### Note: `fetch()` calls are inflight-unique
|
||||
|
||||
If you call `fetch()` multiple times with the same key value,
|
||||
then every call after the first will resolve on the same
|
||||
promise<sup>1</sup>,
|
||||
_even if they have different settings that would otherwise change
|
||||
the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
|
||||
or `ignoreFetchAbort`.
|
||||
|
||||
In most cases, this is not a problem (in fact, only fetching
|
||||
something once is what you probably want, if you're caching in
|
||||
the first place). If you are changing the fetch() options
|
||||
dramatically between runs, there's a good chance that you might
|
||||
be trying to fit divergent semantics into a single object, and
|
||||
would be better off with multiple cache instances.
|
||||
|
||||
**1**: Ie, they're not the "same Promise", but they resolve at
|
||||
the same time, because they're both waiting on the same
|
||||
underlying fetchMethod response.
|
||||
|
||||
### `peek(key, { allowStale } = {}) => value`
|
||||
|
||||
Like `get()` but doesn't update recency or delete stale items.
|
||||
|
||||
Returns `undefined` if the item is stale, unless `allowStale` is
|
||||
set either on the cache or in the options object.
|
||||
|
||||
### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
|
||||
|
||||
Check if a key is in the cache, without updating the recency of
|
||||
use. Age is updated if `updateAgeOnHas` is set to `true` in
|
||||
either the options or the constructor.
|
||||
|
||||
Will return `false` if the item is stale, even though it is
|
||||
technically in the cache. The difference can be determined (if
|
||||
it matters) by using a `status` argument, and inspecting the
|
||||
`has` field.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
Returns `true` if the key was deleted, `false` otherwise.
|
||||
|
||||
### `clear()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
### `keys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rkeys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `values()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from most recently used to least recently used.
|
||||
|
||||
### `rvalues()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from least recently used to most recently used.
|
||||
|
||||
### `entries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rentries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `find(fn, [getOptions])`
|
||||
|
||||
Find a value for which the supplied `fn` method returns a truthy
|
||||
value, similar to `Array.find()`.
|
||||
|
||||
`fn` is called as `fn(value, key, cache)`.
|
||||
|
||||
The optional `getOptions` are applied to the resulting `get()` of
|
||||
the item found.
|
||||
|
||||
### `dump()`
|
||||
|
||||
Return an array of `[key, entry]` objects which can be passed to
|
||||
`cache.load()`
|
||||
|
||||
The `start` fields are calculated relative to a portable
|
||||
`Date.now()` timestamp, even if `performance.now()` is available.
|
||||
|
||||
Stale entries are always included in the `dump`, even if
|
||||
`allowStale` is false.
|
||||
|
||||
Note: this returns an actual array, not a generator, so it can be
|
||||
more easily passed around.
|
||||
|
||||
### `load(entries)`
|
||||
|
||||
Reset the cache and load in the items in `entries` in the order
|
||||
listed. Note that the shape of the resulting cache may be
|
||||
different if the same options are not used in both caches.
|
||||
|
||||
The `start` fields are assumed to be calculated relative to a
|
||||
portable `Date.now()` timestamp, even if `performance.now()` is
|
||||
available.
|
||||
|
||||
### `purgeStale()`
|
||||
|
||||
Delete any stale entries. Returns `true` if anything was
|
||||
removed, `false` otherwise.
|
||||
|
||||
### `getRemainingTTL(key)`
|
||||
|
||||
Return the number of ms left in the item's TTL. If item is not
|
||||
in cache, returns `0`. Returns `Infinity` if item is in cache
|
||||
without a defined TTL.
|
||||
|
||||
### `forEach(fn, [thisp])`
|
||||
|
||||
Call the `fn` function with each set of `fn(value, key, cache)`
|
||||
in the LRU cache, from most recent to least recently used.
|
||||
|
||||
Does not affect recency of use.
|
||||
|
||||
If `thisp` is provided, function will be called in the
|
||||
`this`-context of the provided object.
|
||||
|
||||
### `rforEach(fn, [thisp])`
|
||||
|
||||
Same as `cache.forEach(fn, thisp)`, but in order from least
|
||||
recently used to most recently used.
|
||||
|
||||
### `pop()`
|
||||
|
||||
Evict the least recently used item, returning its value.
|
||||
|
||||
Returns `undefined` if cache is empty.
|
||||
|
||||
## Status Tracking
|
||||
|
||||
Occasionally, it may be useful to track the internal behavior of
|
||||
the cache, particularly for logging, debugging, or for behavior
|
||||
within the `fetchMethod`. To do this, you can pass a `status`
|
||||
object to the `get()`, `set()`, `has()`, and `fetch()` methods.
|
||||
|
||||
The `status` option should be a plain JavaScript object.
|
||||
|
||||
The following fields will be set appropriately:
|
||||
|
||||
```ts
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
* - add: the item was not found in the cache, and was added
|
||||
* - update: the item was in the cache, with the same value provided
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss'
|
||||
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
ttl?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the start time for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
start?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The timestamp used for TTL calculation
|
||||
*/
|
||||
now?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the remaining ttl for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
remainingTTL?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The calculated size for the item, if sizes are used.
|
||||
*/
|
||||
size?: LRUSize
|
||||
|
||||
/**
|
||||
* A flag indicating that the item was not stored, due to exceeding the
|
||||
* {@link maxEntrySize}
|
||||
*/
|
||||
maxEntrySizeExceeded?: true
|
||||
|
||||
/**
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V
|
||||
|
||||
/**
|
||||
* The results of a {@link has} operation
|
||||
*
|
||||
* - hit: the item was found in the cache
|
||||
* - stale: the item was found in the cache, but is stale
|
||||
* - miss: the item was not found in the cache
|
||||
*/
|
||||
has?: 'hit' | 'stale' | 'miss'
|
||||
|
||||
/**
|
||||
* The status of a {@link fetch} operation.
|
||||
* Note that this can change as the underlying fetch() moves through
|
||||
* various states.
|
||||
*
|
||||
* - inflight: there is another fetch() for this key which is in process
|
||||
* - get: there is no fetchMethod, so {@link get} was called.
|
||||
* - miss: the item is not in cache, and will be fetched.
|
||||
* - hit: the item is in the cache, and was resolved immediately.
|
||||
* - stale: the item is in the cache, but stale.
|
||||
* - refresh: the item is in the cache, and not stale, but
|
||||
* {@link forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
|
||||
|
||||
/**
|
||||
* The {@link fetchMethod} was called
|
||||
*/
|
||||
fetchDispatched?: true
|
||||
|
||||
/**
|
||||
* The cached value was updated after a successful call to fetchMethod
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The reason for a fetch() rejection. Either the error raised by the
|
||||
* {@link fetchMethod}, or the reason for an AbortSignal.
|
||||
*/
|
||||
fetchError?: Error
|
||||
|
||||
/**
|
||||
* The fetch received an abort signal
|
||||
*/
|
||||
fetchAborted?: true
|
||||
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise resolved successfully
|
||||
*/
|
||||
fetchResolved?: true
|
||||
|
||||
/**
|
||||
* The results of the fetchMethod promise were stored in the cache
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise was rejected
|
||||
*/
|
||||
fetchRejected?: true
|
||||
|
||||
/**
|
||||
* The status of a {@link get} operation.
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value is
|
||||
* present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss'
|
||||
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true
|
||||
}
|
||||
```
|
||||
For full description of the API and all options, please see [the
|
||||
LRUCache typedocs](https://isaacs.github.io/node-lru-cache/)
|
||||
|
||||
## Storage Bounds Safety
|
||||
|
||||
|
@ -1066,7 +186,7 @@ This cache never stores undefined values, as `undefined` is used
|
|||
internally in a few places to indicate that a key is not in the
|
||||
cache.
|
||||
|
||||
You may call `cache.set(key, undefined)`, but this is just an
|
||||
You may call `cache.set(key, undefined)`, but this is just
|
||||
an alias for `cache.delete(key)`. Note that this has the effect
|
||||
that `cache.has(key)` will return _false_ after setting it to
|
||||
undefined.
|
||||
|
@ -1195,10 +315,17 @@ before, it probably will not work in version 7 and above.
|
|||
- Minified export available at `'lru-cache/min'`, for both CJS
|
||||
and MJS builds.
|
||||
|
||||
## Changes in Version 9
|
||||
## Breaking Changes in Version 9
|
||||
|
||||
- Named export only, no default export.
|
||||
- AbortController polyfill returned, albeit with a warning when
|
||||
used.
|
||||
|
||||
## Breaking Changes in Version 10
|
||||
|
||||
- `cache.fetch()` return type is now `Promise<V | undefined>`
|
||||
instead of `Promise<V | void>`. This is an irrelevant change
|
||||
practically speaking, but can require changes for TypeScript
|
||||
users.
|
||||
|
||||
For more info, see the [change log](CHANGELOG.md).
|
||||
|
|
|
@ -13,7 +13,7 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of
|
|||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made in <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-charts",
|
||||
"version": "26.1.38",
|
||||
"version": "26.1.39",
|
||||
"description": "Feature-rich chart control with built-in support for over 25 chart types, technical indictors, trendline, zooming, tooltip, selection, crosshair and trackball. for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
|
@ -2,7 +2,20 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.39 (2024-06-25)
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### Diagram
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I598320` - The exception is no longer thrown when adding a node at runtime in the unit test case.
|
||||
- `#I597330` - Expanding and collapsing nodes multiple times now works properly.
|
||||
- `#I596153` - Unselecting a selected node using CTRL+Click now works properly when zoom pan is enabled.
|
||||
- `#I595572` - The Exception is no longer thrown when drag and drop shapes on top of each other repeatedly with Line Routing.
|
||||
- `#F188009` - The Exception is no longer thrown When Loading Data Without Defining Node Template at Application Level.
|
||||
- `#F188626` - Position of BPMN activity loop node is now properly rendered while save and load.
|
||||
|
||||
## 26.1.35 (2024-06-11)
|
||||
|
||||
### Diagram
|
||||
|
||||
|
|
6
components/diagrams/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
6
components/diagrams/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
|
@ -1,6 +1,6 @@
|
|||
# 🎭 Playwright
|
||||
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-125.0.6422.26-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-125.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-127.0.6533.17-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-127.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Wed, 05 Jun 2024 07:35:45 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for validator (https://github.com/validat
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/validator.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 11 May 2024 09:35:43 GMT
|
||||
* Last updated: Sun, 16 Jun 2024 11:35:49 GMT
|
||||
* Dependencies: none
|
||||
|
||||
# Credits
|
||||
|
|
282
components/diagrams/node_modules/acorn-walk/node_modules/acorn/README.md
сгенерированный
поставляемый
Normal file
282
components/diagrams/node_modules/acorn-walk/node_modules/acorn/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,282 @@
|
|||
# Acorn
|
||||
|
||||
A tiny, fast JavaScript parser written in JavaScript.
|
||||
|
||||
## Community
|
||||
|
||||
Acorn is open source software released under an
|
||||
[MIT license](https://github.com/acornjs/acorn/blob/master/acorn/LICENSE).
|
||||
|
||||
You are welcome to
|
||||
[report bugs](https://github.com/acornjs/acorn/issues) or create pull
|
||||
requests on [github](https://github.com/acornjs/acorn).
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way to install acorn is from [`npm`](https://www.npmjs.com/):
|
||||
|
||||
```sh
|
||||
npm install acorn
|
||||
```
|
||||
|
||||
Alternately, you can download the source and build acorn yourself:
|
||||
|
||||
```sh
|
||||
git clone https://github.com/acornjs/acorn.git
|
||||
cd acorn
|
||||
npm install
|
||||
```
|
||||
|
||||
## Interface
|
||||
|
||||
**parse**`(input, options)` is the main interface to the library. The
|
||||
`input` parameter is a string, `options` must be an object setting
|
||||
some of the options listed below. The return value will be an abstract
|
||||
syntax tree object as specified by the [ESTree
|
||||
spec](https://github.com/estree/estree).
|
||||
|
||||
```javascript
|
||||
let acorn = require("acorn");
|
||||
console.log(acorn.parse("1 + 1", {ecmaVersion: 2020}));
|
||||
```
|
||||
|
||||
When encountering a syntax error, the parser will raise a
|
||||
`SyntaxError` object with a meaningful message. The error object will
|
||||
have a `pos` property that indicates the string offset at which the
|
||||
error occurred, and a `loc` object that contains a `{line, column}`
|
||||
object referring to that same position.
|
||||
|
||||
Options are provided by in a second argument, which should be an
|
||||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
implemented through plugins.
|
||||
|
||||
- **sourceType**: Indicate the mode the code should be parsed in. Can be
|
||||
either `"script"` or `"module"`. This influences global strict mode
|
||||
and parsing of `import` and `export` declarations.
|
||||
|
||||
**NOTE**: If set to `"module"`, then static `import` / `export` syntax
|
||||
will be valid, even if `ecmaVersion` is less than 6.
|
||||
|
||||
- **onInsertedSemicolon**: If given a callback, that callback will be
|
||||
called whenever a missing semicolon is inserted by the parser. The
|
||||
callback will be given the character offset of the point where the
|
||||
semicolon is inserted as argument, and if `locations` is on, also a
|
||||
`{line, column}` object representing this position.
|
||||
|
||||
- **onTrailingComma**: Like `onInsertedSemicolon`, but for trailing
|
||||
commas.
|
||||
|
||||
- **allowReserved**: If `false`, using a reserved word will generate
|
||||
an error. Defaults to `true` for `ecmaVersion` 3, `false` for higher
|
||||
versions. When given the value `"never"`, reserved words and
|
||||
keywords can also not be used as property names (as in Internet
|
||||
Explorer's old parser).
|
||||
|
||||
- **allowReturnOutsideFunction**: By default, a return statement at
|
||||
the top level raises an error. Set this to `true` to accept such
|
||||
code.
|
||||
|
||||
- **allowImportExportEverywhere**: By default, `import` and `export`
|
||||
declarations can only appear at a program's top level. Setting this
|
||||
option to `true` allows them anywhere where a statement is allowed,
|
||||
and also allows `import.meta` expressions to appear in scripts
|
||||
(when `sourceType` is not `"module"`).
|
||||
|
||||
- **allowAwaitOutsideFunction**: If `false`, `await` expressions can
|
||||
only appear inside `async` functions. Defaults to `true` in modules
|
||||
for `ecmaVersion` 2022 and later, `false` for lower versions.
|
||||
Setting this option to `true` allows to have top-level `await`
|
||||
expressions. They are still not allowed in non-`async` functions,
|
||||
though.
|
||||
|
||||
- **allowSuperOutsideMethod**: By default, `super` outside a method
|
||||
raises an error. Set this to `true` to accept such code.
|
||||
|
||||
- **allowHashBang**: When this is enabled, if the code starts with the
|
||||
characters `#!` (as in a shellscript), the first line will be
|
||||
treated as a comment. Defaults to true when `ecmaVersion` >= 2023.
|
||||
|
||||
- **checkPrivateFields**: By default, the parser will verify that
|
||||
private properties are only used in places where they are valid and
|
||||
have been declared. Set this to false to turn such checks off.
|
||||
|
||||
- **locations**: When `true`, each node has a `loc` object attached
|
||||
with `start` and `end` subobjects, each of which contains the
|
||||
one-based line and zero-based column numbers in `{line, column}`
|
||||
form. Default is `false`.
|
||||
|
||||
- **onToken**: If a function is passed for this option, each found
|
||||
token will be passed in same format as tokens returned from
|
||||
`tokenizer().getToken()`.
|
||||
|
||||
If array is passed, each found token is pushed to it.
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **onComment**: If a function is passed for this option, whenever a
|
||||
comment is encountered the function will be called with the
|
||||
following parameters:
|
||||
|
||||
- `block`: `true` if the comment is a block comment, false if it
|
||||
is a line comment.
|
||||
- `text`: The content of the comment.
|
||||
- `start`: Character offset of the start of the comment.
|
||||
- `end`: Character offset of the end of the comment.
|
||||
|
||||
When the `locations` options is on, the `{line, column}` locations
|
||||
of the comment’s start and end are passed as two additional
|
||||
parameters.
|
||||
|
||||
If array is passed for this option, each found comment is pushed
|
||||
to it as object in Esprima format:
|
||||
|
||||
```javascript
|
||||
{
|
||||
"type": "Line" | "Block",
|
||||
"value": "comment text",
|
||||
"start": Number,
|
||||
"end": Number,
|
||||
// If `locations` option is on:
|
||||
"loc": {
|
||||
"start": {line: Number, column: Number}
|
||||
"end": {line: Number, column: Number}
|
||||
},
|
||||
// If `ranges` option is on:
|
||||
"range": [Number, Number]
|
||||
}
|
||||
```
|
||||
|
||||
Note that you are not allowed to call the parser from the
|
||||
callback—that will corrupt its internal state.
|
||||
|
||||
- **ranges**: Nodes have their start and end characters offsets
|
||||
recorded in `start` and `end` properties (directly on the node,
|
||||
rather than the `loc` object, which holds line/column data. To also
|
||||
add a
|
||||
[semi-standardized](https://bugzilla.mozilla.org/show_bug.cgi?id=745678)
|
||||
`range` property holding a `[start, end]` array with the same
|
||||
numbers, set the `ranges` option to `true`.
|
||||
|
||||
- **program**: It is possible to parse multiple files into a single
|
||||
AST by passing the tree produced by parsing the first file as the
|
||||
`program` option in subsequent parses. This will add the toplevel
|
||||
forms of the parsed file to the "Program" (top) node of an existing
|
||||
parse tree.
|
||||
|
||||
- **sourceFile**: When the `locations` option is `true`, you can pass
|
||||
this option to add a `source` attribute in every node’s `loc`
|
||||
object. Note that the contents of this option are not examined or
|
||||
processed in any way; you are free to use whatever format you
|
||||
choose.
|
||||
|
||||
- **directSourceFile**: Like `sourceFile`, but a `sourceFile` property
|
||||
will be added (regardless of the `location` option) directly to the
|
||||
nodes, rather than the `loc` object.
|
||||
|
||||
- **preserveParens**: If this option is `true`, parenthesized expressions
|
||||
are represented by (non-standard) `ParenthesizedExpression` nodes
|
||||
that have a single `expression` property containing the expression
|
||||
inside parentheses.
|
||||
|
||||
**parseExpressionAt**`(input, offset, options)` will parse a single
|
||||
expression in a string, and return its AST. It will not complain if
|
||||
there is more of the string left after the expression.
|
||||
|
||||
**tokenizer**`(input, options)` returns an object with a `getToken`
|
||||
method that can be called repeatedly to get the next token, a `{start,
|
||||
end, type, value}` object (with added `loc` property when the
|
||||
`locations` option is enabled and `range` property when the `ranges`
|
||||
option is enabled). When the token's type is `tokTypes.eof`, you
|
||||
should stop calling the method, since it will keep returning that same
|
||||
token forever.
|
||||
|
||||
Note that tokenizing JavaScript without parsing it is, in modern
|
||||
versions of the language, not really possible due to the way syntax is
|
||||
overloaded in ways that can only be disambiguated by the parse
|
||||
context. This package applies a bunch of heuristics to try and do a
|
||||
reasonable job, but you are advised to use `parse` with the `onToken`
|
||||
option instead of this.
|
||||
|
||||
In ES6 environment, returned result can be used as any other
|
||||
protocol-compliant iterable:
|
||||
|
||||
```javascript
|
||||
for (let token of acorn.tokenizer(str)) {
|
||||
// iterate over the tokens
|
||||
}
|
||||
|
||||
// transform code to array of tokens:
|
||||
var tokens = [...acorn.tokenizer(str)];
|
||||
```
|
||||
|
||||
**tokTypes** holds an object mapping names to the token type objects
|
||||
that end up in the `type` properties of tokens.
|
||||
|
||||
**getLineInfo**`(input, offset)` can be used to get a `{line,
|
||||
column}` object for a given program string and offset.
|
||||
|
||||
### The `Parser` class
|
||||
|
||||
Instances of the **`Parser`** class contain all the state and logic
|
||||
that drives a parse. It has static methods `parse`,
|
||||
`parseExpressionAt`, and `tokenizer` that match the top-level
|
||||
functions by the same name.
|
||||
|
||||
When extending the parser with plugins, you need to call these methods
|
||||
on the extended version of the class. To extend a parser with plugins,
|
||||
you can use its static `extend` method.
|
||||
|
||||
```javascript
|
||||
var acorn = require("acorn");
|
||||
var jsx = require("acorn-jsx");
|
||||
var JSXParser = acorn.Parser.extend(jsx());
|
||||
JSXParser.parse("foo(<bar/>)", {ecmaVersion: 2020});
|
||||
```
|
||||
|
||||
The `extend` method takes any number of plugin values, and returns a
|
||||
new `Parser` class that includes the extra parser logic provided by
|
||||
the plugins.
|
||||
|
||||
## Command line interface
|
||||
|
||||
The `bin/acorn` utility can be used to parse a file from the command
|
||||
line. It accepts as arguments its input file and the following
|
||||
options:
|
||||
|
||||
- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|--ecma10`: Sets the ECMAScript version
|
||||
to parse. Default is version 9.
|
||||
|
||||
- `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise.
|
||||
|
||||
- `--locations`: Attaches a "loc" object to each node with "start" and
|
||||
"end" subobjects, each of which contains the one-based line and
|
||||
zero-based column numbers in `{line, column}` form.
|
||||
|
||||
- `--allow-hash-bang`: If the code starts with the characters #! (as
|
||||
in a shellscript), the first line will be treated as a comment.
|
||||
|
||||
- `--allow-await-outside-function`: Allows top-level `await` expressions.
|
||||
See the `allowAwaitOutsideFunction` option for more information.
|
||||
|
||||
- `--compact`: No whitespace is used in the AST output.
|
||||
|
||||
- `--silent`: Do not output the AST, just return the exit status.
|
||||
|
||||
- `--help`: Print the usage information and quit.
|
||||
|
||||
The utility spits out the syntax tree as JSON data.
|
||||
|
||||
## Existing plugins
|
||||
|
||||
- [`acorn-jsx`](https://github.com/RReverser/acorn-jsx): Parse [Facebook JSX syntax extensions](https://github.com/facebook/jsx)
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1635.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1650.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
103
components/diagrams/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/diagrams/node_modules/engine.io-client/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
103
components/diagrams/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/diagrams/node_modules/engine.io/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
|
@ -88,3 +88,41 @@ status code rather than reporting the signal properly. This
|
|||
module tries to do the right thing, but on Windows systems, you
|
||||
may see that incorrect result. There is as far as I'm aware no
|
||||
workaround for this.
|
||||
|
||||
## util: `foreground-child/proxy-signals`
|
||||
|
||||
If you just want to proxy the signals to a child process that the
|
||||
main process receives, you can use the `proxy-signals` export
|
||||
from this package.
|
||||
|
||||
```js
|
||||
import { proxySignals } from 'foreground-child/proxy-signals'
|
||||
|
||||
const childProcess = spawn('command', ['some', 'args'])
|
||||
proxySignals(childProcess)
|
||||
```
|
||||
|
||||
Now, any fatal signal received by the current process will be
|
||||
proxied to the child process.
|
||||
|
||||
It doesn't go in the other direction; ie, signals sent to the
|
||||
child process will not affect the parent. For that, listen to the
|
||||
child `exit` or `close` events, and handle them appropriately.
|
||||
|
||||
## util: `foreground-child/watchdog`
|
||||
|
||||
If you are spawning a child process, and want to ensure that it
|
||||
isn't left dangling if the parent process exits, you can use the
|
||||
watchdog utility exported by this module.
|
||||
|
||||
```js
|
||||
import { watchdog } from 'foreground-child/watchdog'
|
||||
|
||||
const childProcess = spawn('command', ['some', 'args'])
|
||||
const watchdogProcess = watchdog(childProcess)
|
||||
|
||||
// watchdogProcess is a reference to the process monitoring the
|
||||
// parent and child. There's usually no reason to do anything
|
||||
// with it, as it's silent and will terminate
|
||||
// automatically when it's no longer needed.
|
||||
```
|
||||
|
|
2
components/diagrams/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
2
components/diagrams/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
11
components/diagrams/node_modules/karma-typescript/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/diagrams/node_modules/karma-typescript/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
148
components/diagrams/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/diagrams/node_modules/karma-typescript/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
895
components/diagrams/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
895
components/diagrams/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
|
@ -102,888 +102,8 @@ cache.clear() // empty the cache
|
|||
If you put more stuff in the cache, then less recently used items
|
||||
will fall out. That's what an LRU cache is.
|
||||
|
||||
## `class LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new `LRUCache` object.
|
||||
|
||||
When using TypeScript, set the `K` and `V` types to the `key` and
|
||||
`value` types, respectively.
|
||||
|
||||
The `FC` ("fetch context") generic type defaults to `unknown`.
|
||||
If set to a value other than `void` or `undefined`, then any
|
||||
calls to `cache.fetch()` _must_ provide a `context` option
|
||||
matching the `FC` type. If `FC` is set to `void` or `undefined`,
|
||||
then `cache.fetch()` _must not_ provide a `context` option. See
|
||||
the documentation on `async fetch()` below.
|
||||
|
||||
## Options
|
||||
|
||||
All options are available on the LRUCache instance, making it
|
||||
safe to pass an LRUCache instance as the options argument to make
|
||||
another empty cache of the same type.
|
||||
|
||||
Some options are marked read-only because changing them after
|
||||
instantiation is not safe. Changing any of the other options
|
||||
will of course only have an effect on subsequent method calls.
|
||||
|
||||
### `max` (read only)
|
||||
|
||||
The maximum number of items that remain in the cache (assuming no
|
||||
TTL pruning or explicit deletions). Note that fewer items may be
|
||||
stored if size calculation is used, and `maxSize` is exceeded.
|
||||
This must be a positive finite intger.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
**It is strongly recommended to set a `max` to prevent unbounded
|
||||
growth of the cache.** See "Storage Bounds Safety" below.
|
||||
|
||||
### `maxSize` (read only)
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and automatically evict items in order to stay below
|
||||
this size. Note that this may result in fewer than `max` items
|
||||
being stored.
|
||||
|
||||
Attempting to add an item to the cache whose calculated size is
|
||||
greater that this amount will be a no-op. The item will not be
|
||||
cached, and no other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided.
|
||||
|
||||
Sets `maxEntrySize` to the same value, unless a different value
|
||||
is provided for `maxEntrySize`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if size tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
### `maxEntrySize`
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and prevent caching any item over a given size.
|
||||
Attempting to add an item whose calculated size is greater than
|
||||
this amount will be a no-op. The item will not be cached, and no
|
||||
other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided. Defaults to
|
||||
the value of `maxSize` if provided.
|
||||
|
||||
### `sizeCalculation`
|
||||
|
||||
Function used to calculate the size of stored items. If you're
|
||||
storing strings or buffers, then you probably want to do
|
||||
something like `n => n.length`. The item is passed as the first
|
||||
argument, and the key is passed as the second argument.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Requires `maxSize` to be set.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
### `fetchMethod` (read only)
|
||||
|
||||
Function that is used to make background asynchronous fetches.
|
||||
Called with `fetchMethod(key, staleValue, { signal, options,
|
||||
context })`. May return a Promise.
|
||||
|
||||
If `fetchMethod` is not provided, then `cache.fetch(key)` is
|
||||
equivalent to `Promise.resolve(cache.get(key))`.
|
||||
|
||||
If at any time, `signal.aborted` is set to `true`, or if the
|
||||
`signal.onabort` method is called, or if it emits an `'abort'`
|
||||
event which you can listen to with `addEventListener`, then that
|
||||
means that the fetch should be abandoned. This may be passed
|
||||
along to async functions aware of AbortController/AbortSignal
|
||||
behavior.
|
||||
|
||||
The `fetchMethod` should **only** return `undefined` or a Promise
|
||||
resolving to `undefined` if the AbortController signaled an
|
||||
`abort` event. In all other cases, it should return or resolve
|
||||
to a value suitable for adding to the cache.
|
||||
|
||||
The `options` object is a union of the options that may be
|
||||
provided to `set()` and `get()`. If they are modified, then that
|
||||
will result in modifying the settings to `cache.set()` when the
|
||||
value is resolved, and in the case of `noDeleteOnFetchRejection`
|
||||
and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
|
||||
failures.
|
||||
|
||||
For example, a DNS cache may update the TTL based on the value
|
||||
returned from a remote DNS server by changing `options.ttl` in
|
||||
the `fetchMethod`.
|
||||
|
||||
### `noDeleteOnFetchRejection`
|
||||
|
||||
If a `fetchMethod` throws an error or returns a rejected promise,
|
||||
then by default, any existing stale value will be removed from
|
||||
the cache.
|
||||
|
||||
If `noDeleteOnFetchRejection` is set to `true`, then this
|
||||
behavior is suppressed, and the stale value remains in the cache
|
||||
in the case of a rejected `fetchMethod`.
|
||||
|
||||
This is important in cases where a `fetchMethod` is _only_ called
|
||||
as a background update while the stale value is returned, when
|
||||
`allowStale` is used.
|
||||
|
||||
This is implicitly in effect when `allowStaleOnFetchRejection` is
|
||||
set.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchRejection`
|
||||
|
||||
Set to true to return a stale value from the cache when a
|
||||
`fetchMethod` throws an error or returns a rejected Promise.
|
||||
|
||||
If a `fetchMethod` fails, and there is no stale value available,
|
||||
the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
|
||||
errors are suppressed.
|
||||
|
||||
Implies `noDeleteOnFetchRejection`.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchAbort`
|
||||
|
||||
Set to true to return a stale value from the cache when the
|
||||
`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
|
||||
event, whether user-triggered, or due to internal cache behavior.
|
||||
|
||||
Unless `ignoreFetchAbort` is also set, the underlying
|
||||
`fetchMethod` will still be considered canceled, and any value
|
||||
it returns will be ignored and not cached.
|
||||
|
||||
Caveat: since fetches are aborted when a new value is explicitly
|
||||
set in the cache, this can lead to fetch returning a stale value,
|
||||
since that was the fallback value _at the moment the `fetch()` was
|
||||
initiated_, even though the new updated value is now present in
|
||||
the cache.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const cache = new LRUCache<string, any>({
|
||||
ttl: 100,
|
||||
fetchMethod: async (url, oldValue, { signal }) => {
|
||||
const res = await fetch(url, { signal })
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
cache.set('https://example.com/', { some: 'data' })
|
||||
// 100ms go by...
|
||||
const result = cache.fetch('https://example.com/')
|
||||
cache.set('https://example.com/', { other: 'thing' })
|
||||
console.log(await result) // { some: 'data' }
|
||||
console.log(cache.get('https://example.com/')) // { other: 'thing' }
|
||||
```
|
||||
|
||||
### `ignoreFetchAbort`
|
||||
|
||||
Set to true to ignore the `abort` event emitted by the
|
||||
`AbortSignal` object passed to `fetchMethod`, and still cache the
|
||||
resulting resolution value, as long as it is not `undefined`.
|
||||
|
||||
When used on its own, this means aborted `fetch()` calls are not
|
||||
immediately resolved or rejected when they are aborted, and
|
||||
instead take the full time to await.
|
||||
|
||||
When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
|
||||
will resolve immediately to their stale cached value or
|
||||
`undefined`, and will continue to process and eventually update
|
||||
the cache when they resolve, as long as the resulting value is
|
||||
not `undefined`, thus supporting a "return stale on timeout while
|
||||
refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
|
||||
signal.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const c = new LRUCache({
|
||||
ttl: 100,
|
||||
ignoreFetchAbort: true,
|
||||
allowStaleOnFetchAbort: true,
|
||||
fetchMethod: async (key, oldValue, { signal }) => {
|
||||
// note: do NOT pass the signal to fetch()!
|
||||
// let's say this fetch can take a long time.
|
||||
const res = await fetch(`https://slow-backend-server/${key}`)
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
// this will return the stale value after 100ms, while still
|
||||
// updating in the background for next time.
|
||||
const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
|
||||
```
|
||||
|
||||
**Note**: regardless of this setting, an `abort` event _is still
|
||||
emitted on the `AbortSignal` object_, so may result in invalid
|
||||
results when passed to other underlying APIs that use
|
||||
AbortSignals.
|
||||
|
||||
This may be overridden on the `fetch()` call or in the
|
||||
`fetchMethod` itself.
|
||||
|
||||
### `dispose` (read only)
|
||||
|
||||
Function that is called on items when they are dropped from the
|
||||
cache, as `this.dispose(value, key, reason)`.
|
||||
|
||||
This can be handy if you want to close file descriptors or do
|
||||
other cleanup tasks when items are no longer stored in the cache.
|
||||
|
||||
**NOTE**: It is called _before_ the item has been fully removed
|
||||
from the cache, so if you want to put it right back in, you need
|
||||
to wait until the next tick. If you try to add it back in during
|
||||
the `dispose()` function call, it will break things in subtle and
|
||||
weird ways.
|
||||
|
||||
Unlike several other options, this may _not_ be overridden by
|
||||
passing an option to `set()`, for performance reasons.
|
||||
|
||||
The `reason` will be one of the following strings, corresponding
|
||||
to the reason for the item's deletion:
|
||||
|
||||
- `evict` Item was evicted to make space for a new addition
|
||||
- `set` Item was overwritten by a new value
|
||||
- `delete` Item was removed by explicit `cache.delete(key)` or by
|
||||
calling `cache.clear()`, which deletes everything.
|
||||
|
||||
The `dispose()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
Optional, must be a function.
|
||||
|
||||
### `disposeAfter` (read only)
|
||||
|
||||
The same as `dispose`, but called _after_ the entry is completely
|
||||
removed and the cache is once again in a clean state.
|
||||
|
||||
It is safe to add an item right back into the cache at this
|
||||
point. However, note that it is _very_ easy to inadvertently
|
||||
create infinite recursion in this way.
|
||||
|
||||
The `disposeAfter()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
### `noDisposeOnSet`
|
||||
|
||||
Set to `true` to suppress calling the `dispose()` function if the
|
||||
entry key is still accessible within the cache.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Boolean, default `false`. Only relevant if `dispose` or
|
||||
`disposeAfter` options are set.
|
||||
|
||||
### `ttl`
|
||||
|
||||
Max time to live for items before they are considered stale.
|
||||
Note that stale items are NOT preemptively removed by default,
|
||||
and MAY live in the cache, contributing to its LRU max, long
|
||||
after they have expired.
|
||||
|
||||
Also, as this cache is optimized for LRU/MRU operations, some of
|
||||
the staleness/TTL checks will reduce performance.
|
||||
|
||||
This is not primarily a TTL cache, and does not make strong TTL
|
||||
guarantees. There is no pre-emptive pruning of expired items,
|
||||
but you _may_ set a TTL on the cache, and it will treat expired
|
||||
items as missing when they are fetched, and delete them.
|
||||
|
||||
Optional, but must be a positive integer in ms if specified.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if ttl tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
If ttl tracking is enabled, and `max` and `maxSize` are not set,
|
||||
and `ttlAutopurge` is not set, then a warning will be emitted
|
||||
cautioning about the potential for unbounded memory consumption.
|
||||
(The TypeScript definitions will also discourage this.)
|
||||
|
||||
### `noUpdateTTL`
|
||||
|
||||
Boolean flag to tell the cache to not update the TTL when setting
|
||||
a new value for an existing key (ie, when updating a value rather
|
||||
than inserting a new value). Note that the TTL value is _always_
|
||||
set (if provided) when adding a new entry into the cache.
|
||||
|
||||
This may be passed as an option to `cache.set()`.
|
||||
|
||||
Boolean, default false.
|
||||
|
||||
### `ttlResolution`
|
||||
|
||||
Minimum amount of time in ms in which to check for staleness.
|
||||
Defaults to `1`, which means that the current time is checked at
|
||||
most once per millisecond.
|
||||
|
||||
Set to `0` to check the current time every time staleness is
|
||||
tested.
|
||||
|
||||
Note that setting this to a higher value _will_ improve
|
||||
performance somewhat while using ttl tracking, albeit at the
|
||||
expense of keeping stale items around a bit longer than intended.
|
||||
|
||||
### `ttlAutopurge`
|
||||
|
||||
Preemptively remove stale items from the cache.
|
||||
|
||||
Note that this may _significantly_ degrade performance,
|
||||
especially if the cache is storing a large number of items. It
|
||||
is almost always best to just leave the stale items in the cache,
|
||||
and let them fall out as new items are added.
|
||||
|
||||
Note that this means that `allowStale` is a bit pointless, as
|
||||
stale items will be deleted almost as soon as they expire.
|
||||
|
||||
Use with caution!
|
||||
|
||||
Boolean, default `false`
|
||||
|
||||
### `allowStale`
|
||||
|
||||
By default, if you set `ttl`, it'll only delete stale items from
|
||||
the cache when you `get(key)`. That is, it's not preemptively
|
||||
pruning items.
|
||||
|
||||
If you set `allowStale:true`, it'll return the stale value as
|
||||
well as deleting it. If you don't set this, then it'll return
|
||||
`undefined` when you try to get a stale entry.
|
||||
|
||||
Note that when a stale entry is fetched, _even if it is returned
|
||||
due to `allowStale` being set_, it is removed from the cache
|
||||
immediately. You can immediately put it back in the cache if you
|
||||
wish, thus resetting the TTL.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`. The `cache.has()` method will always return
|
||||
`false` for stale items.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `noDeleteOnStaleGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, by default stale
|
||||
items will be removed from the cache when the key is accessed
|
||||
with `cache.get()`.
|
||||
|
||||
Setting `noDeleteOnStaleGet` to `true` will cause stale items to
|
||||
remain in the cache, until they are explicitly deleted with
|
||||
`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
|
||||
to `false`.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever it is
|
||||
retrieved from cache with `get()`, causing it to not expire. (It
|
||||
can still fall out of cache based on recency of use, of course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnHas`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever its presence
|
||||
in the cache is checked with `has()`, causing it to not expire.
|
||||
(It can still fall out of cache based on recency of use, of
|
||||
course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.has()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
## API
|
||||
|
||||
### `new LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new LRUCache. All options are documented above, and are
|
||||
on the cache as public members.
|
||||
|
||||
The `K` and `V` types define the key and value types,
|
||||
respectively. The optional `FC` type defines the type of the
|
||||
`context` object passed to `cache.fetch()`.
|
||||
|
||||
Keys and values **must not** be `null` or `undefined`.
|
||||
|
||||
### `cache.max`, `cache.maxSize`, `cache.allowStale`,
|
||||
|
||||
`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
|
||||
`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
|
||||
`cache.updateAgeOnHas`
|
||||
|
||||
All option names are exposed as public members on the cache
|
||||
object.
|
||||
|
||||
These are intended for read access only. Changing them during
|
||||
program operation can cause undefined behavior.
|
||||
|
||||
### `cache.size`
|
||||
|
||||
The total number of items held in the cache at the current
|
||||
moment.
|
||||
|
||||
### `cache.calculatedSize`
|
||||
|
||||
The total size of items in cache when using size tracking.
|
||||
|
||||
### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
|
||||
|
||||
Add a value to the cache.
|
||||
|
||||
Optional options object may contain `ttl` and `sizeCalculation`
|
||||
as described above, which default to the settings on the cache
|
||||
object.
|
||||
|
||||
If `start` is provided, then that will set the effective start
|
||||
time for the TTL calculation. Note that this must be a previous
|
||||
value of `performance.now()` if supported, or a previous value of
|
||||
`Date.now()` if not.
|
||||
|
||||
Options object may also include `size`, which will prevent
|
||||
calling the `sizeCalculation` function and just use the specified
|
||||
number if it is a positive integer, and `noDisposeOnSet` which
|
||||
will prevent calling a `dispose` function in the case of
|
||||
overwrites.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
Will update the recency of the entry.
|
||||
|
||||
Returns the cache object.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
If the value is `undefined`, then this is an alias for
|
||||
`cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
See **Storing Undefined Values** below.
|
||||
|
||||
### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
|
||||
|
||||
Return a value from the cache.
|
||||
|
||||
Will update the recency of the cache entry found.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `info(key) => Entry | undefined`
|
||||
|
||||
Return an `Entry` object containing the currently cached value,
|
||||
as well as ttl and size information if available. Returns
|
||||
undefined if the key is not found in the cache.
|
||||
|
||||
Unlike `dump()` (which is designed to be portable and survive
|
||||
serialization), the `start` value is always the current
|
||||
timestamp, and the `ttl` is a calculated remaining time to live
|
||||
(negative if expired).
|
||||
|
||||
Note that stale values are always returned, rather than being
|
||||
pruned and treated as if they were not in the cache. If you wish
|
||||
to exclude stale entries, guard against a negative `ttl` value.
|
||||
|
||||
### `async fetch(key, options = {}) => Promise`
|
||||
|
||||
The following options are supported:
|
||||
|
||||
- `updateAgeOnGet`
|
||||
- `allowStale`
|
||||
- `size`
|
||||
- `sizeCalculation`
|
||||
- `ttl`
|
||||
- `noDisposeOnSet`
|
||||
- `forceRefresh`
|
||||
- `status` - See **Status Tracking** below.
|
||||
- `signal` - AbortSignal can be used to cancel the `fetch()`.
|
||||
Note that the `signal` option provided to the `fetchMethod` is
|
||||
a different object, because it must also respond to internal
|
||||
cache state changes, but aborting this signal will abort the
|
||||
one passed to `fetchMethod` as well.
|
||||
- `context` - sets the `context` option passed to the underlying
|
||||
`fetchMethod`.
|
||||
|
||||
If the value is in the cache and not stale, then the returned
|
||||
Promise resolves to the value.
|
||||
|
||||
If not in the cache, or beyond its TTL staleness, then
|
||||
`fetchMethod(key, staleValue, { options, signal, context })` is
|
||||
called, and the value returned will be added to the cache once
|
||||
resolved.
|
||||
|
||||
If called with `allowStale`, and an asynchronous fetch is
|
||||
currently in progress to reload a stale value, then the former
|
||||
stale value will be returned.
|
||||
|
||||
If called with `forceRefresh`, then the cached item will be
|
||||
re-fetched, even if it is not stale. However, if `allowStale` is
|
||||
set, then the old value will still be returned. This is useful
|
||||
in cases where you want to force a reload of a cached value. If
|
||||
a background fetch is already in progress, then `forceRefresh`
|
||||
has no effect.
|
||||
|
||||
Multiple fetches for the same `key` will only call `fetchMethod`
|
||||
a single time, and all will be resolved when the value is
|
||||
resolved, even if different options are used.
|
||||
|
||||
If `fetchMethod` is not specified, then this is effectively an
|
||||
alias for `Promise.resolve(cache.get(key))`.
|
||||
|
||||
When the fetch method resolves to a value, if the fetch has not
|
||||
been aborted due to deletion, eviction, or being overwritten,
|
||||
then it is added to the cache using the options provided.
|
||||
|
||||
If the key is evicted or deleted before the `fetchMethod`
|
||||
resolves, then the AbortSignal passed to the `fetchMethod` will
|
||||
receive an `abort` event, and the promise returned by `fetch()`
|
||||
will reject with the reason for the abort.
|
||||
|
||||
If a `signal` is passed to the `fetch()` call, then aborting the
|
||||
signal will abort the fetch and cause the `fetch()` promise to
|
||||
reject with the reason provided.
|
||||
|
||||
#### Setting `context`
|
||||
|
||||
If an `FC` type is set to a type other than `unknown`, `void`, or
|
||||
`undefined` in the LRUCache constructor, then all
|
||||
calls to `cache.fetch()` _must_ provide a `context` option. If
|
||||
set to `undefined` or `void`, then calls to fetch _must not_
|
||||
provide a `context` option.
|
||||
|
||||
The `context` param allows you to provide arbitrary data that
|
||||
might be relevant in the course of fetching the data. It is only
|
||||
relevant for the course of a single `fetch()` operation, and
|
||||
discarded afterwards.
|
||||
|
||||
#### Note: `fetch()` calls are inflight-unique
|
||||
|
||||
If you call `fetch()` multiple times with the same key value,
|
||||
then every call after the first will resolve on the same
|
||||
promise<sup>1</sup>,
|
||||
_even if they have different settings that would otherwise change
|
||||
the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
|
||||
or `ignoreFetchAbort`.
|
||||
|
||||
In most cases, this is not a problem (in fact, only fetching
|
||||
something once is what you probably want, if you're caching in
|
||||
the first place). If you are changing the fetch() options
|
||||
dramatically between runs, there's a good chance that you might
|
||||
be trying to fit divergent semantics into a single object, and
|
||||
would be better off with multiple cache instances.
|
||||
|
||||
**1**: Ie, they're not the "same Promise", but they resolve at
|
||||
the same time, because they're both waiting on the same
|
||||
underlying fetchMethod response.
|
||||
|
||||
### `peek(key, { allowStale } = {}) => value`
|
||||
|
||||
Like `get()` but doesn't update recency or delete stale items.
|
||||
|
||||
Returns `undefined` if the item is stale, unless `allowStale` is
|
||||
set either on the cache or in the options object.
|
||||
|
||||
### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
|
||||
|
||||
Check if a key is in the cache, without updating the recency of
|
||||
use. Age is updated if `updateAgeOnHas` is set to `true` in
|
||||
either the options or the constructor.
|
||||
|
||||
Will return `false` if the item is stale, even though it is
|
||||
technically in the cache. The difference can be determined (if
|
||||
it matters) by using a `status` argument, and inspecting the
|
||||
`has` field.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
Returns `true` if the key was deleted, `false` otherwise.
|
||||
|
||||
### `clear()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
### `keys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rkeys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `values()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from most recently used to least recently used.
|
||||
|
||||
### `rvalues()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from least recently used to most recently used.
|
||||
|
||||
### `entries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rentries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `find(fn, [getOptions])`
|
||||
|
||||
Find a value for which the supplied `fn` method returns a truthy
|
||||
value, similar to `Array.find()`.
|
||||
|
||||
`fn` is called as `fn(value, key, cache)`.
|
||||
|
||||
The optional `getOptions` are applied to the resulting `get()` of
|
||||
the item found.
|
||||
|
||||
### `dump()`
|
||||
|
||||
Return an array of `[key, entry]` objects which can be passed to
|
||||
`cache.load()`
|
||||
|
||||
The `start` fields are calculated relative to a portable
|
||||
`Date.now()` timestamp, even if `performance.now()` is available.
|
||||
|
||||
Stale entries are always included in the `dump`, even if
|
||||
`allowStale` is false.
|
||||
|
||||
Note: this returns an actual array, not a generator, so it can be
|
||||
more easily passed around.
|
||||
|
||||
### `load(entries)`
|
||||
|
||||
Reset the cache and load in the items in `entries` in the order
|
||||
listed. Note that the shape of the resulting cache may be
|
||||
different if the same options are not used in both caches.
|
||||
|
||||
The `start` fields are assumed to be calculated relative to a
|
||||
portable `Date.now()` timestamp, even if `performance.now()` is
|
||||
available.
|
||||
|
||||
### `purgeStale()`
|
||||
|
||||
Delete any stale entries. Returns `true` if anything was
|
||||
removed, `false` otherwise.
|
||||
|
||||
### `getRemainingTTL(key)`
|
||||
|
||||
Return the number of ms left in the item's TTL. If item is not
|
||||
in cache, returns `0`. Returns `Infinity` if item is in cache
|
||||
without a defined TTL.
|
||||
|
||||
### `forEach(fn, [thisp])`
|
||||
|
||||
Call the `fn` function with each set of `fn(value, key, cache)`
|
||||
in the LRU cache, from most recent to least recently used.
|
||||
|
||||
Does not affect recency of use.
|
||||
|
||||
If `thisp` is provided, function will be called in the
|
||||
`this`-context of the provided object.
|
||||
|
||||
### `rforEach(fn, [thisp])`
|
||||
|
||||
Same as `cache.forEach(fn, thisp)`, but in order from least
|
||||
recently used to most recently used.
|
||||
|
||||
### `pop()`
|
||||
|
||||
Evict the least recently used item, returning its value.
|
||||
|
||||
Returns `undefined` if cache is empty.
|
||||
|
||||
## Status Tracking
|
||||
|
||||
Occasionally, it may be useful to track the internal behavior of
|
||||
the cache, particularly for logging, debugging, or for behavior
|
||||
within the `fetchMethod`. To do this, you can pass a `status`
|
||||
object to the `get()`, `set()`, `has()`, and `fetch()` methods.
|
||||
|
||||
The `status` option should be a plain JavaScript object.
|
||||
|
||||
The following fields will be set appropriately:
|
||||
|
||||
```ts
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
* - add: the item was not found in the cache, and was added
|
||||
* - update: the item was in the cache, with the same value provided
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss'
|
||||
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
ttl?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the start time for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
start?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The timestamp used for TTL calculation
|
||||
*/
|
||||
now?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the remaining ttl for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
remainingTTL?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The calculated size for the item, if sizes are used.
|
||||
*/
|
||||
size?: LRUSize
|
||||
|
||||
/**
|
||||
* A flag indicating that the item was not stored, due to exceeding the
|
||||
* {@link maxEntrySize}
|
||||
*/
|
||||
maxEntrySizeExceeded?: true
|
||||
|
||||
/**
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V
|
||||
|
||||
/**
|
||||
* The results of a {@link has} operation
|
||||
*
|
||||
* - hit: the item was found in the cache
|
||||
* - stale: the item was found in the cache, but is stale
|
||||
* - miss: the item was not found in the cache
|
||||
*/
|
||||
has?: 'hit' | 'stale' | 'miss'
|
||||
|
||||
/**
|
||||
* The status of a {@link fetch} operation.
|
||||
* Note that this can change as the underlying fetch() moves through
|
||||
* various states.
|
||||
*
|
||||
* - inflight: there is another fetch() for this key which is in process
|
||||
* - get: there is no fetchMethod, so {@link get} was called.
|
||||
* - miss: the item is not in cache, and will be fetched.
|
||||
* - hit: the item is in the cache, and was resolved immediately.
|
||||
* - stale: the item is in the cache, but stale.
|
||||
* - refresh: the item is in the cache, and not stale, but
|
||||
* {@link forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
|
||||
|
||||
/**
|
||||
* The {@link fetchMethod} was called
|
||||
*/
|
||||
fetchDispatched?: true
|
||||
|
||||
/**
|
||||
* The cached value was updated after a successful call to fetchMethod
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The reason for a fetch() rejection. Either the error raised by the
|
||||
* {@link fetchMethod}, or the reason for an AbortSignal.
|
||||
*/
|
||||
fetchError?: Error
|
||||
|
||||
/**
|
||||
* The fetch received an abort signal
|
||||
*/
|
||||
fetchAborted?: true
|
||||
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise resolved successfully
|
||||
*/
|
||||
fetchResolved?: true
|
||||
|
||||
/**
|
||||
* The results of the fetchMethod promise were stored in the cache
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise was rejected
|
||||
*/
|
||||
fetchRejected?: true
|
||||
|
||||
/**
|
||||
* The status of a {@link get} operation.
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value is
|
||||
* present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss'
|
||||
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true
|
||||
}
|
||||
```
|
||||
For full description of the API and all options, please see [the
|
||||
LRUCache typedocs](https://isaacs.github.io/node-lru-cache/)
|
||||
|
||||
## Storage Bounds Safety
|
||||
|
||||
|
@ -1066,7 +186,7 @@ This cache never stores undefined values, as `undefined` is used
|
|||
internally in a few places to indicate that a key is not in the
|
||||
cache.
|
||||
|
||||
You may call `cache.set(key, undefined)`, but this is just an
|
||||
You may call `cache.set(key, undefined)`, but this is just
|
||||
an alias for `cache.delete(key)`. Note that this has the effect
|
||||
that `cache.has(key)` will return _false_ after setting it to
|
||||
undefined.
|
||||
|
@ -1195,10 +315,17 @@ before, it probably will not work in version 7 and above.
|
|||
- Minified export available at `'lru-cache/min'`, for both CJS
|
||||
and MJS builds.
|
||||
|
||||
## Changes in Version 9
|
||||
## Breaking Changes in Version 9
|
||||
|
||||
- Named export only, no default export.
|
||||
- AbortController polyfill returned, albeit with a warning when
|
||||
used.
|
||||
|
||||
## Breaking Changes in Version 10
|
||||
|
||||
- `cache.fetch()` return type is now `Promise<V | undefined>`
|
||||
instead of `Promise<V | void>`. This is an irrelevant change
|
||||
practically speaking, but can require changes for TypeScript
|
||||
users.
|
||||
|
||||
For more info, see the [change log](CHANGELOG.md).
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
# Punycode.js [![Build status](https://travis-ci.org/bestiejs/punycode.js.svg?branch=master)](https://travis-ci.org/bestiejs/punycode.js) [![Code coverage status](http://img.shields.io/coveralls/bestiejs/punycode.js/master.svg)](https://coveralls.io/r/bestiejs/punycode.js) [![Dependency status](https://gemnasium.com/bestiejs/punycode.js.svg)](https://gemnasium.com/bestiejs/punycode.js)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
A robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891), and works on nearly all JavaScript platforms.
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
|
@ -10,26 +10,60 @@ This JavaScript library is the result of comparing, optimizing and documenting d
|
|||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
This project is [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with [Node.js v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) and [io.js v1.0.0+](https://github.com/iojs/io.js/blob/v1.x/lib/punycode.js).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
Via [npm](https://www.npmjs.com/) (only required for Node.js releases older than v0.6.2):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
npm install punycode
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
Via [Bower](http://bower.io/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
```bash
|
||||
bower install punycode
|
||||
```
|
||||
|
||||
Via [Component](https://github.com/component/component):
|
||||
|
||||
```bash
|
||||
component install bestiejs/punycode.js
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="punycode.js"></script>
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/):
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
var punycode = require('punycode');
|
||||
```
|
||||
|
||||
In [Rhino](http://www.mozilla.org/rhino/):
|
||||
|
||||
```js
|
||||
load('punycode.js');
|
||||
```
|
||||
|
||||
Using an AMD loader like [RequireJS](http://requirejs.org/):
|
||||
|
||||
```js
|
||||
require(
|
||||
{
|
||||
'paths': {
|
||||
'punycode': 'path/to/punycode'
|
||||
}
|
||||
},
|
||||
['punycode'],
|
||||
function(punycode) {
|
||||
console.log(punycode);
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
## API
|
||||
|
@ -115,27 +149,15 @@ punycode.ucs2.encode([0x1D306]);
|
|||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
## Unit tests & code coverage
|
||||
|
||||
### How to publish a new release
|
||||
After cloning this repository, run `npm install --dev` to install the dependencies needed for Punycode.js development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`.
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
To generate the code coverage report, use `grunt cover`.
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
Feel free to fork if you see possible improvements!
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -143,6 +165,12 @@ A string representing the current Punycode.js version number.
|
|||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## Contributors
|
||||
|
||||
| [![twitter/jdalton](https://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") |
|
||||
|---|
|
||||
| [John-David Dalton](http://allyoucanleet.com/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
||||
|
|
103
components/diagrams/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
103
components/diagrams/node_modules/socket.io-adapter/node_modules/ws/README.md
сгенерированный
поставляемый
|
@ -1,7 +1,7 @@
|
|||
# ws: a Node.js WebSocket library
|
||||
|
||||
[![Version npm](https://img.shields.io/npm/v/ws.svg?logo=npm)](https://www.npmjs.com/package/ws)
|
||||
[![CI](https://img.shields.io/github/workflow/status/websockets/ws/CI/master?label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![CI](https://img.shields.io/github/actions/workflow/status/websockets/ws/ci.yml?branch=master&label=CI&logo=github)](https://github.com/websockets/ws/actions?query=workflow%3ACI+branch%3Amaster)
|
||||
[![Coverage Status](https://img.shields.io/coveralls/websockets/ws/master.svg?logo=coveralls)](https://coveralls.io/github/websockets/ws)
|
||||
|
||||
ws is a simple to use, blazing fast, and thoroughly tested WebSocket client and
|
||||
|
@ -11,8 +11,8 @@ Passes the quite extensive Autobahn test suite: [server][server-report],
|
|||
[client][client-report].
|
||||
|
||||
**Note**: This module does not work in the browser. The client in the docs is a
|
||||
reference to a back end with the role of a client in the WebSocket
|
||||
communication. Browser clients must use the native
|
||||
reference to a backend with the role of a client in the WebSocket communication.
|
||||
Browser clients must use the native
|
||||
[`WebSocket`](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket)
|
||||
object. To make the same code work seamlessly on Node.js and the browser, you
|
||||
can use one of the many wrappers available on npm, like
|
||||
|
@ -23,6 +23,7 @@ can use one of the many wrappers available on npm, like
|
|||
- [Protocol support](#protocol-support)
|
||||
- [Installing](#installing)
|
||||
- [Opt-in for performance](#opt-in-for-performance)
|
||||
- [Legacy opt-in for performance](#legacy-opt-in-for-performance)
|
||||
- [API docs](#api-docs)
|
||||
- [WebSocket compression](#websocket-compression)
|
||||
- [Usage examples](#usage-examples)
|
||||
|
@ -57,23 +58,37 @@ npm install ws
|
|||
|
||||
### Opt-in for performance
|
||||
|
||||
There are 2 optional modules that can be installed along side with the ws
|
||||
module. These modules are binary addons which improve certain operations.
|
||||
Prebuilt binaries are available for the most popular platforms so you don't
|
||||
necessarily need to have a C++ compiler installed on your machine.
|
||||
[bufferutil][] is an optional module that can be installed alongside the ws
|
||||
module:
|
||||
|
||||
- `npm install --save-optional bufferutil`: Allows to efficiently perform
|
||||
operations such as masking and unmasking the data payload of the WebSocket
|
||||
frames.
|
||||
- `npm install --save-optional utf-8-validate`: Allows to efficiently check if a
|
||||
message contains valid UTF-8.
|
||||
```
|
||||
npm install --save-optional bufferutil
|
||||
```
|
||||
|
||||
To not even try to require and use these modules, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) and
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment
|
||||
variables. These might be useful to enhance security in systems where a user can
|
||||
put a package in the package search path of an application of another user, due
|
||||
to how the Node.js resolver algorithm works.
|
||||
This is a binary addon that improves the performance of certain operations such
|
||||
as masking and unmasking the data payload of the WebSocket frames. Prebuilt
|
||||
binaries are available for the most popular platforms, so you don't necessarily
|
||||
need to have a C++ compiler installed on your machine.
|
||||
|
||||
To force ws to not use bufferutil, use the
|
||||
[`WS_NO_BUFFER_UTIL`](./doc/ws.md#ws_no_buffer_util) environment variable. This
|
||||
can be useful to enhance security in systems where a user can put a package in
|
||||
the package search path of an application of another user, due to how the
|
||||
Node.js resolver algorithm works.
|
||||
|
||||
#### Legacy opt-in for performance
|
||||
|
||||
If you are running on an old version of Node.js (prior to v18.14.0), ws also
|
||||
supports the [utf-8-validate][] module:
|
||||
|
||||
```
|
||||
npm install --save-optional utf-8-validate
|
||||
```
|
||||
|
||||
This contains a binary polyfill for [`buffer.isUtf8()`][].
|
||||
|
||||
To force ws not to use utf-8-validate, use the
|
||||
[`WS_NO_UTF_8_VALIDATE`](./doc/ws.md#ws_no_utf_8_validate) environment variable.
|
||||
|
||||
## API docs
|
||||
|
||||
|
@ -131,7 +146,7 @@ const wss = new WebSocketServer({
|
|||
```
|
||||
|
||||
The client will only use the extension if it is supported and enabled on the
|
||||
server. To always disable the extension on the client set the
|
||||
server. To always disable the extension on the client, set the
|
||||
`perMessageDeflate` option to `false`.
|
||||
|
||||
```js
|
||||
|
@ -151,6 +166,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
ws.send('something');
|
||||
});
|
||||
|
@ -167,6 +184,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('ws://www.host.com/path');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
const array = new Float32Array(5);
|
||||
|
||||
|
@ -186,6 +205,8 @@ import { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -208,6 +229,8 @@ const server = createServer({
|
|||
const wss = new WebSocketServer({ server });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log('received: %s', data);
|
||||
});
|
||||
|
@ -222,7 +245,6 @@ server.listen(8080);
|
|||
|
||||
```js
|
||||
import { createServer } from 'http';
|
||||
import { parse } from 'url';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
const server = createServer();
|
||||
|
@ -230,15 +252,19 @@ const wss1 = new WebSocketServer({ noServer: true });
|
|||
const wss2 = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss1.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
wss2.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
// ...
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
const { pathname } = parse(request.url);
|
||||
const { pathname } = new URL(request.url, 'wss://base.url');
|
||||
|
||||
if (pathname === '/foo') {
|
||||
wss1.handleUpgrade(request, socket, head, function done(ws) {
|
||||
|
@ -262,16 +288,24 @@ server.listen(8080);
|
|||
import { createServer } from 'http';
|
||||
import { WebSocketServer } from 'ws';
|
||||
|
||||
function onSocketError(err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
const server = createServer();
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
|
||||
wss.on('connection', function connection(ws, request, client) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data) {
|
||||
console.log(`Received message ${data} from user ${client}`);
|
||||
});
|
||||
});
|
||||
|
||||
server.on('upgrade', function upgrade(request, socket, head) {
|
||||
socket.on('error', onSocketError);
|
||||
|
||||
// This function is not defined on purpose. Implement it with your own logic.
|
||||
authenticate(request, function next(err, client) {
|
||||
if (err || !client) {
|
||||
|
@ -280,6 +314,8 @@ server.on('upgrade', function upgrade(request, socket, head) {
|
|||
return;
|
||||
}
|
||||
|
||||
socket.removeListener('error', onSocketError);
|
||||
|
||||
wss.handleUpgrade(request, socket, head, function done(ws) {
|
||||
wss.emit('connection', ws, request, client);
|
||||
});
|
||||
|
@ -302,6 +338,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
|
@ -321,6 +359,8 @@ import WebSocket, { WebSocketServer } from 'ws';
|
|||
const wss = new WebSocketServer({ port: 8080 });
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('message', function message(data, isBinary) {
|
||||
wss.clients.forEach(function each(client) {
|
||||
if (client !== ws && client.readyState === WebSocket.OPEN) {
|
||||
|
@ -338,6 +378,8 @@ import WebSocket from 'ws';
|
|||
|
||||
const ws = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
ws.on('error', console.error);
|
||||
|
||||
ws.on('open', function open() {
|
||||
console.log('connected');
|
||||
ws.send(Date.now());
|
||||
|
@ -365,6 +407,8 @@ const ws = new WebSocket('wss://websocket-echo.com/');
|
|||
|
||||
const duplex = createWebSocketStream(ws, { encoding: 'utf8' });
|
||||
|
||||
duplex.on('error', console.error);
|
||||
|
||||
duplex.pipe(process.stdout);
|
||||
process.stdin.pipe(duplex);
|
||||
```
|
||||
|
@ -389,6 +433,8 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.socket.remoteAddress;
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
|
@ -398,16 +444,18 @@ the `X-Forwarded-For` header.
|
|||
```js
|
||||
wss.on('connection', function connection(ws, req) {
|
||||
const ip = req.headers['x-forwarded-for'].split(',')[0].trim();
|
||||
|
||||
ws.on('error', console.error);
|
||||
});
|
||||
```
|
||||
|
||||
### How to detect and close broken connections?
|
||||
|
||||
Sometimes the link between the server and the client can be interrupted in a way
|
||||
that keeps both the server and the client unaware of the broken state of the
|
||||
Sometimes, the link between the server and the client can be interrupted in a
|
||||
way that keeps both the server and the client unaware of the broken state of the
|
||||
connection (e.g. when pulling the cord).
|
||||
|
||||
In these cases ping messages can be used as a means to verify that the remote
|
||||
In these cases, ping messages can be used as a means to verify that the remote
|
||||
endpoint is still responsive.
|
||||
|
||||
```js
|
||||
|
@ -421,6 +469,7 @@ const wss = new WebSocketServer({ port: 8080 });
|
|||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.isAlive = true;
|
||||
ws.on('error', console.error);
|
||||
ws.on('pong', heartbeat);
|
||||
});
|
||||
|
||||
|
@ -441,7 +490,7 @@ wss.on('close', function close() {
|
|||
Pong messages are automatically sent in response to ping messages as required by
|
||||
the spec.
|
||||
|
||||
Just like the server example above your clients might as well lose connection
|
||||
Just like the server example above, your clients might as well lose connection
|
||||
without knowing it. You might want to add a ping listener on your clients to
|
||||
prevent that. A simple implementation would be:
|
||||
|
||||
|
@ -462,6 +511,7 @@ function heartbeat() {
|
|||
|
||||
const client = new WebSocket('wss://websocket-echo.com/');
|
||||
|
||||
client.on('error', console.error);
|
||||
client.on('open', heartbeat);
|
||||
client.on('ping', heartbeat);
|
||||
client.on('close', function clear() {
|
||||
|
@ -482,6 +532,8 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[`buffer.isutf8()`]: https://nodejs.org/api/buffer.html#bufferisutf8input
|
||||
[bufferutil]: https://github.com/websockets/bufferutil
|
||||
[changelog]: https://github.com/websockets/ws/releases
|
||||
[client-report]: http://websockets.github.io/ws/autobahn/clients/
|
||||
[https-proxy-agent]: https://github.com/TooTallNate/node-https-proxy-agent
|
||||
|
@ -492,4 +544,5 @@ We're using the GitHub [releases][changelog] for changelog entries.
|
|||
[server-report]: http://websockets.github.io/ws/autobahn/servers/
|
||||
[session-parse-example]: ./examples/express-session-parse
|
||||
[socks-proxy-agent]: https://github.com/TooTallNate/node-socks-proxy-agent
|
||||
[utf-8-validate]: https://github.com/websockets/utf-8-validate
|
||||
[ws-server-options]: ./doc/ws.md#new-websocketserveroptions-callback
|
||||
|
|
11
components/diagrams/node_modules/terser/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/diagrams/node_modules/terser/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
148
components/diagrams/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/diagrams/node_modules/tough-cookie/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
148
components/diagrams/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
148
components/diagrams/node_modules/uri-js/node_modules/punycode/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,148 @@
|
|||
# Punycode.js [![punycode on npm](https://img.shields.io/npm/v/punycode)](https://www.npmjs.com/package/punycode) [![](https://data.jsdelivr.com/v1/package/npm/punycode/badge)](https://www.jsdelivr.com/package/npm/punycode)
|
||||
|
||||
Punycode.js is a robust Punycode converter that fully complies to [RFC 3492](https://tools.ietf.org/html/rfc3492) and [RFC 5891](https://tools.ietf.org/html/rfc5891).
|
||||
|
||||
This JavaScript library is the result of comparing, optimizing and documenting different open-source implementations of the Punycode algorithm:
|
||||
|
||||
* [The C example code from RFC 3492](https://tools.ietf.org/html/rfc3492#appendix-C)
|
||||
* [`punycode.c` by _Markus W. Scherer_ (IBM)](http://opensource.apple.com/source/ICU/ICU-400.42/icuSources/common/punycode.c)
|
||||
* [`punycode.c` by _Ben Noordhuis_](https://github.com/bnoordhuis/punycode/blob/master/punycode.c)
|
||||
* [JavaScript implementation by _some_](http://stackoverflow.com/questions/183485/can-anyone-recommend-a-good-free-javascript-for-punycode-to-unicode-conversion/301287#301287)
|
||||
* [`punycode.js` by _Ben Noordhuis_](https://github.com/joyent/node/blob/426298c8c1c0d5b5224ac3658c41e7c2a3fe9377/lib/punycode.js) (note: [not fully compliant](https://github.com/joyent/node/issues/2072))
|
||||
|
||||
This project was [bundled](https://github.com/joyent/node/blob/master/lib/punycode.js) with Node.js from [v0.6.2+](https://github.com/joyent/node/compare/975f1930b1...61e796decc) until [v7](https://github.com/nodejs/node/pull/7941) (soft-deprecated).
|
||||
|
||||
This project provides a CommonJS module that uses ES2015+ features and JavaScript module, which work in modern Node.js versions and browsers. For the old Punycode.js version that offers the same functionality in a UMD build with support for older pre-ES2015 runtimes, including Rhino, Ringo, and Narwhal, see [v1.4.1](https://github.com/mathiasbynens/punycode.js/releases/tag/v1.4.1).
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](https://www.npmjs.com/):
|
||||
|
||||
```bash
|
||||
npm install punycode --save
|
||||
```
|
||||
|
||||
In [Node.js](https://nodejs.org/):
|
||||
|
||||
> ⚠️ Note that userland modules don't hide core modules.
|
||||
> For example, `require('punycode')` still imports the deprecated core module even if you executed `npm install punycode`.
|
||||
> Use `require('punycode/')` to import userland modules rather than core modules.
|
||||
|
||||
```js
|
||||
const punycode = require('punycode/');
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `punycode.decode(string)`
|
||||
|
||||
Converts a Punycode string of ASCII symbols to a string of Unicode symbols.
|
||||
|
||||
```js
|
||||
// decode domain name parts
|
||||
punycode.decode('maana-pta'); // 'mañana'
|
||||
punycode.decode('--dqo34k'); // '☃-⌘'
|
||||
```
|
||||
|
||||
### `punycode.encode(string)`
|
||||
|
||||
Converts a string of Unicode symbols to a Punycode string of ASCII symbols.
|
||||
|
||||
```js
|
||||
// encode domain name parts
|
||||
punycode.encode('mañana'); // 'maana-pta'
|
||||
punycode.encode('☃-⌘'); // '--dqo34k'
|
||||
```
|
||||
|
||||
### `punycode.toUnicode(input)`
|
||||
|
||||
Converts a Punycode string representing a domain name or an email address to Unicode. Only the Punycoded parts of the input will be converted, i.e. it doesn’t matter if you call it on a string that has already been converted to Unicode.
|
||||
|
||||
```js
|
||||
// decode domain names
|
||||
punycode.toUnicode('xn--maana-pta.com');
|
||||
// → 'mañana.com'
|
||||
punycode.toUnicode('xn----dqo34k.com');
|
||||
// → '☃-⌘.com'
|
||||
|
||||
// decode email addresses
|
||||
punycode.toUnicode('джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq');
|
||||
// → 'джумла@джpумлатест.bрфa'
|
||||
```
|
||||
|
||||
### `punycode.toASCII(input)`
|
||||
|
||||
Converts a lowercased Unicode string representing a domain name or an email address to Punycode. Only the non-ASCII parts of the input will be converted, i.e. it doesn’t matter if you call it with a domain that’s already in ASCII.
|
||||
|
||||
```js
|
||||
// encode domain names
|
||||
punycode.toASCII('mañana.com');
|
||||
// → 'xn--maana-pta.com'
|
||||
punycode.toASCII('☃-⌘.com');
|
||||
// → 'xn----dqo34k.com'
|
||||
|
||||
// encode email addresses
|
||||
punycode.toASCII('джумла@джpумлатест.bрфa');
|
||||
// → 'джумла@xn--p-8sbkgc5ag7bhce.xn--ba-lmcq'
|
||||
```
|
||||
|
||||
### `punycode.ucs2`
|
||||
|
||||
#### `punycode.ucs2.decode(string)`
|
||||
|
||||
Creates an array containing the numeric code point values of each Unicode symbol in the string. While [JavaScript uses UCS-2 internally](https://mathiasbynens.be/notes/javascript-encoding), this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16.
|
||||
|
||||
```js
|
||||
punycode.ucs2.decode('abc');
|
||||
// → [0x61, 0x62, 0x63]
|
||||
// surrogate pair for U+1D306 TETRAGRAM FOR CENTRE:
|
||||
punycode.ucs2.decode('\uD834\uDF06');
|
||||
// → [0x1D306]
|
||||
```
|
||||
|
||||
#### `punycode.ucs2.encode(codePoints)`
|
||||
|
||||
Creates a string based on an array of numeric code point values.
|
||||
|
||||
```js
|
||||
punycode.ucs2.encode([0x61, 0x62, 0x63]);
|
||||
// → 'abc'
|
||||
punycode.ucs2.encode([0x1D306]);
|
||||
// → '\uD834\uDF06'
|
||||
```
|
||||
|
||||
### `punycode.version`
|
||||
|
||||
A string representing the current Punycode.js version number.
|
||||
|
||||
## For maintainers
|
||||
|
||||
### How to publish a new release
|
||||
|
||||
1. On the `main` branch, bump the version number in `package.json`:
|
||||
|
||||
```sh
|
||||
npm version patch -m 'Release v%s'
|
||||
```
|
||||
|
||||
Instead of `patch`, use `minor` or `major` [as needed](https://semver.org/).
|
||||
|
||||
Note that this produces a Git commit + tag.
|
||||
|
||||
1. Push the release commit and tag:
|
||||
|
||||
```sh
|
||||
git push && git push --tags
|
||||
```
|
||||
|
||||
Our CI then automatically publishes the new release to npm, under both the [`punycode`](https://www.npmjs.com/package/punycode) and [`punycode.js`](https://www.npmjs.com/package/punycode.js) names.
|
||||
|
||||
## Author
|
||||
|
||||
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
Punycode.js is available under the [MIT](https://mths.be/mit) license.
|
11
components/diagrams/node_modules/webpack/node_modules/acorn/README.md
сгенерированный
поставляемый
11
components/diagrams/node_modules/webpack/node_modules/acorn/README.md
сгенерированный
поставляемый
|
@ -50,12 +50,11 @@ Options are provided by in a second argument, which should be an
|
|||
object containing any of these fields (only `ecmaVersion` is
|
||||
required):
|
||||
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Must be
|
||||
either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 (2019),
|
||||
11 (2020), 12 (2021), 13 (2022), 14 (2023), or `"latest"` (the
|
||||
latest the library supports). This influences support for strict
|
||||
mode, the set of reserved words, and support for new syntax
|
||||
features.
|
||||
- **ecmaVersion**: Indicates the ECMAScript version to parse. Can be a
|
||||
number, either in year (`2022`) or plain version number (`6`) form,
|
||||
or `"latest"` (the latest the library supports). This influences
|
||||
support for strict mode, the set of reserved words, and support for
|
||||
new syntax features.
|
||||
|
||||
**NOTE**: Only 'stage 4' (finalized) ECMAScript features are being
|
||||
implemented by Acorn. Other proposed new features must be
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-diagrams",
|
||||
"version": "19.18.0",
|
||||
"version": "26.1.35",
|
||||
"description": "Feature-rich diagram control to create diagrams like flow charts, organizational charts, mind maps, and BPMN diagrams. Its rich feature set includes built-in shapes, editing, serializing, exporting, printing, overview, data binding, and automatic layouts. for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
|
@ -2,6 +2,23 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### DocumentEditor
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I599170` - Resolved the bookmarks are not added properly in Document Editor.
|
||||
- `#I599982` - Resolved the bookmark not navigation issue while clicking the hyperlink.
|
||||
- `#I600181` - Resolved the script error issue when modify the levels in table of contents.
|
||||
- `#I598250` - Resolved the before comment action event behaviour issues.
|
||||
- `#I576525` - Resolved the performance issue when editing paragraph that split into multiple pages.
|
||||
- `#I600212`, `#I429607` - Resolved the bookmark is not retrieved when selecting the table cell.
|
||||
|
||||
#### Features
|
||||
|
||||
- `#I559439` - Added support to apply multicolumn for selected paragraph.
|
||||
|
||||
## 26.1.39 (2024-06-25)
|
||||
|
||||
### DocumentEditor
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 22 Jun 2024 07:35:32 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1647.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1651.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
2
components/documenteditor/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
2
components/documenteditor/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
|
@ -6,16 +6,8 @@
|
|||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP verbs that Node.js core's HTTP parser supports.
|
||||
HTTP verbs that node core's parser supports.
|
||||
|
||||
This module provides an export that is just like `http.METHODS` from Node.js core,
|
||||
with the following differences:
|
||||
|
||||
* All method names are lower-cased.
|
||||
* Contains a fallback list of methods for Node.js versions that do not have a
|
||||
`http.METHODS` export (0.10 and lower).
|
||||
* Provides the fallback list when using tools like `browserify` without pulling
|
||||
in the `http` shim module.
|
||||
|
||||
## Install
|
||||
|
||||
|
@ -31,9 +23,7 @@ var methods = require('methods')
|
|||
|
||||
### methods
|
||||
|
||||
This is an array of lower-cased method names that Node.js supports. If Node.js
|
||||
provides the `http.METHODS` export, then this is the same array lower-cased,
|
||||
otherwise it is a snapshot of the verbs from Node.js 0.10.
|
||||
This is an array of lower-case method names that Node.js supports.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -42,7 +32,7 @@ otherwise it is a snapshot of the verbs from Node.js 0.10.
|
|||
[npm-image]: https://img.shields.io/npm/v/methods.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/methods
|
||||
[node-version-image]: https://img.shields.io/node/v/methods.svg?style=flat
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/methods.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/methods
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/methods.svg?style=flat
|
||||
|
|
|
@ -88,16 +88,4 @@ restuls in:
|
|||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Issue Reporting
|
||||
|
||||
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
||||
|
||||
## Author
|
||||
|
||||
[Auth0](auth0.com)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
||||
```
|
895
components/documenteditor/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
895
components/documenteditor/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
|
@ -102,888 +102,8 @@ cache.clear() // empty the cache
|
|||
If you put more stuff in the cache, then less recently used items
|
||||
will fall out. That's what an LRU cache is.
|
||||
|
||||
## `class LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new `LRUCache` object.
|
||||
|
||||
When using TypeScript, set the `K` and `V` types to the `key` and
|
||||
`value` types, respectively.
|
||||
|
||||
The `FC` ("fetch context") generic type defaults to `unknown`.
|
||||
If set to a value other than `void` or `undefined`, then any
|
||||
calls to `cache.fetch()` _must_ provide a `context` option
|
||||
matching the `FC` type. If `FC` is set to `void` or `undefined`,
|
||||
then `cache.fetch()` _must not_ provide a `context` option. See
|
||||
the documentation on `async fetch()` below.
|
||||
|
||||
## Options
|
||||
|
||||
All options are available on the LRUCache instance, making it
|
||||
safe to pass an LRUCache instance as the options argument to make
|
||||
another empty cache of the same type.
|
||||
|
||||
Some options are marked read-only because changing them after
|
||||
instantiation is not safe. Changing any of the other options
|
||||
will of course only have an effect on subsequent method calls.
|
||||
|
||||
### `max` (read only)
|
||||
|
||||
The maximum number of items that remain in the cache (assuming no
|
||||
TTL pruning or explicit deletions). Note that fewer items may be
|
||||
stored if size calculation is used, and `maxSize` is exceeded.
|
||||
This must be a positive finite intger.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
**It is strongly recommended to set a `max` to prevent unbounded
|
||||
growth of the cache.** See "Storage Bounds Safety" below.
|
||||
|
||||
### `maxSize` (read only)
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and automatically evict items in order to stay below
|
||||
this size. Note that this may result in fewer than `max` items
|
||||
being stored.
|
||||
|
||||
Attempting to add an item to the cache whose calculated size is
|
||||
greater that this amount will be a no-op. The item will not be
|
||||
cached, and no other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided.
|
||||
|
||||
Sets `maxEntrySize` to the same value, unless a different value
|
||||
is provided for `maxEntrySize`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if size tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
### `maxEntrySize`
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and prevent caching any item over a given size.
|
||||
Attempting to add an item whose calculated size is greater than
|
||||
this amount will be a no-op. The item will not be cached, and no
|
||||
other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided. Defaults to
|
||||
the value of `maxSize` if provided.
|
||||
|
||||
### `sizeCalculation`
|
||||
|
||||
Function used to calculate the size of stored items. If you're
|
||||
storing strings or buffers, then you probably want to do
|
||||
something like `n => n.length`. The item is passed as the first
|
||||
argument, and the key is passed as the second argument.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Requires `maxSize` to be set.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
### `fetchMethod` (read only)
|
||||
|
||||
Function that is used to make background asynchronous fetches.
|
||||
Called with `fetchMethod(key, staleValue, { signal, options,
|
||||
context })`. May return a Promise.
|
||||
|
||||
If `fetchMethod` is not provided, then `cache.fetch(key)` is
|
||||
equivalent to `Promise.resolve(cache.get(key))`.
|
||||
|
||||
If at any time, `signal.aborted` is set to `true`, or if the
|
||||
`signal.onabort` method is called, or if it emits an `'abort'`
|
||||
event which you can listen to with `addEventListener`, then that
|
||||
means that the fetch should be abandoned. This may be passed
|
||||
along to async functions aware of AbortController/AbortSignal
|
||||
behavior.
|
||||
|
||||
The `fetchMethod` should **only** return `undefined` or a Promise
|
||||
resolving to `undefined` if the AbortController signaled an
|
||||
`abort` event. In all other cases, it should return or resolve
|
||||
to a value suitable for adding to the cache.
|
||||
|
||||
The `options` object is a union of the options that may be
|
||||
provided to `set()` and `get()`. If they are modified, then that
|
||||
will result in modifying the settings to `cache.set()` when the
|
||||
value is resolved, and in the case of `noDeleteOnFetchRejection`
|
||||
and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
|
||||
failures.
|
||||
|
||||
For example, a DNS cache may update the TTL based on the value
|
||||
returned from a remote DNS server by changing `options.ttl` in
|
||||
the `fetchMethod`.
|
||||
|
||||
### `noDeleteOnFetchRejection`
|
||||
|
||||
If a `fetchMethod` throws an error or returns a rejected promise,
|
||||
then by default, any existing stale value will be removed from
|
||||
the cache.
|
||||
|
||||
If `noDeleteOnFetchRejection` is set to `true`, then this
|
||||
behavior is suppressed, and the stale value remains in the cache
|
||||
in the case of a rejected `fetchMethod`.
|
||||
|
||||
This is important in cases where a `fetchMethod` is _only_ called
|
||||
as a background update while the stale value is returned, when
|
||||
`allowStale` is used.
|
||||
|
||||
This is implicitly in effect when `allowStaleOnFetchRejection` is
|
||||
set.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchRejection`
|
||||
|
||||
Set to true to return a stale value from the cache when a
|
||||
`fetchMethod` throws an error or returns a rejected Promise.
|
||||
|
||||
If a `fetchMethod` fails, and there is no stale value available,
|
||||
the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
|
||||
errors are suppressed.
|
||||
|
||||
Implies `noDeleteOnFetchRejection`.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchAbort`
|
||||
|
||||
Set to true to return a stale value from the cache when the
|
||||
`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
|
||||
event, whether user-triggered, or due to internal cache behavior.
|
||||
|
||||
Unless `ignoreFetchAbort` is also set, the underlying
|
||||
`fetchMethod` will still be considered canceled, and any value
|
||||
it returns will be ignored and not cached.
|
||||
|
||||
Caveat: since fetches are aborted when a new value is explicitly
|
||||
set in the cache, this can lead to fetch returning a stale value,
|
||||
since that was the fallback value _at the moment the `fetch()` was
|
||||
initiated_, even though the new updated value is now present in
|
||||
the cache.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const cache = new LRUCache<string, any>({
|
||||
ttl: 100,
|
||||
fetchMethod: async (url, oldValue, { signal }) => {
|
||||
const res = await fetch(url, { signal })
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
cache.set('https://example.com/', { some: 'data' })
|
||||
// 100ms go by...
|
||||
const result = cache.fetch('https://example.com/')
|
||||
cache.set('https://example.com/', { other: 'thing' })
|
||||
console.log(await result) // { some: 'data' }
|
||||
console.log(cache.get('https://example.com/')) // { other: 'thing' }
|
||||
```
|
||||
|
||||
### `ignoreFetchAbort`
|
||||
|
||||
Set to true to ignore the `abort` event emitted by the
|
||||
`AbortSignal` object passed to `fetchMethod`, and still cache the
|
||||
resulting resolution value, as long as it is not `undefined`.
|
||||
|
||||
When used on its own, this means aborted `fetch()` calls are not
|
||||
immediately resolved or rejected when they are aborted, and
|
||||
instead take the full time to await.
|
||||
|
||||
When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
|
||||
will resolve immediately to their stale cached value or
|
||||
`undefined`, and will continue to process and eventually update
|
||||
the cache when they resolve, as long as the resulting value is
|
||||
not `undefined`, thus supporting a "return stale on timeout while
|
||||
refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
|
||||
signal.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const c = new LRUCache({
|
||||
ttl: 100,
|
||||
ignoreFetchAbort: true,
|
||||
allowStaleOnFetchAbort: true,
|
||||
fetchMethod: async (key, oldValue, { signal }) => {
|
||||
// note: do NOT pass the signal to fetch()!
|
||||
// let's say this fetch can take a long time.
|
||||
const res = await fetch(`https://slow-backend-server/${key}`)
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
// this will return the stale value after 100ms, while still
|
||||
// updating in the background for next time.
|
||||
const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
|
||||
```
|
||||
|
||||
**Note**: regardless of this setting, an `abort` event _is still
|
||||
emitted on the `AbortSignal` object_, so may result in invalid
|
||||
results when passed to other underlying APIs that use
|
||||
AbortSignals.
|
||||
|
||||
This may be overridden on the `fetch()` call or in the
|
||||
`fetchMethod` itself.
|
||||
|
||||
### `dispose` (read only)
|
||||
|
||||
Function that is called on items when they are dropped from the
|
||||
cache, as `this.dispose(value, key, reason)`.
|
||||
|
||||
This can be handy if you want to close file descriptors or do
|
||||
other cleanup tasks when items are no longer stored in the cache.
|
||||
|
||||
**NOTE**: It is called _before_ the item has been fully removed
|
||||
from the cache, so if you want to put it right back in, you need
|
||||
to wait until the next tick. If you try to add it back in during
|
||||
the `dispose()` function call, it will break things in subtle and
|
||||
weird ways.
|
||||
|
||||
Unlike several other options, this may _not_ be overridden by
|
||||
passing an option to `set()`, for performance reasons.
|
||||
|
||||
The `reason` will be one of the following strings, corresponding
|
||||
to the reason for the item's deletion:
|
||||
|
||||
- `evict` Item was evicted to make space for a new addition
|
||||
- `set` Item was overwritten by a new value
|
||||
- `delete` Item was removed by explicit `cache.delete(key)` or by
|
||||
calling `cache.clear()`, which deletes everything.
|
||||
|
||||
The `dispose()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
Optional, must be a function.
|
||||
|
||||
### `disposeAfter` (read only)
|
||||
|
||||
The same as `dispose`, but called _after_ the entry is completely
|
||||
removed and the cache is once again in a clean state.
|
||||
|
||||
It is safe to add an item right back into the cache at this
|
||||
point. However, note that it is _very_ easy to inadvertently
|
||||
create infinite recursion in this way.
|
||||
|
||||
The `disposeAfter()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
### `noDisposeOnSet`
|
||||
|
||||
Set to `true` to suppress calling the `dispose()` function if the
|
||||
entry key is still accessible within the cache.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Boolean, default `false`. Only relevant if `dispose` or
|
||||
`disposeAfter` options are set.
|
||||
|
||||
### `ttl`
|
||||
|
||||
Max time to live for items before they are considered stale.
|
||||
Note that stale items are NOT preemptively removed by default,
|
||||
and MAY live in the cache, contributing to its LRU max, long
|
||||
after they have expired.
|
||||
|
||||
Also, as this cache is optimized for LRU/MRU operations, some of
|
||||
the staleness/TTL checks will reduce performance.
|
||||
|
||||
This is not primarily a TTL cache, and does not make strong TTL
|
||||
guarantees. There is no pre-emptive pruning of expired items,
|
||||
but you _may_ set a TTL on the cache, and it will treat expired
|
||||
items as missing when they are fetched, and delete them.
|
||||
|
||||
Optional, but must be a positive integer in ms if specified.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if ttl tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
If ttl tracking is enabled, and `max` and `maxSize` are not set,
|
||||
and `ttlAutopurge` is not set, then a warning will be emitted
|
||||
cautioning about the potential for unbounded memory consumption.
|
||||
(The TypeScript definitions will also discourage this.)
|
||||
|
||||
### `noUpdateTTL`
|
||||
|
||||
Boolean flag to tell the cache to not update the TTL when setting
|
||||
a new value for an existing key (ie, when updating a value rather
|
||||
than inserting a new value). Note that the TTL value is _always_
|
||||
set (if provided) when adding a new entry into the cache.
|
||||
|
||||
This may be passed as an option to `cache.set()`.
|
||||
|
||||
Boolean, default false.
|
||||
|
||||
### `ttlResolution`
|
||||
|
||||
Minimum amount of time in ms in which to check for staleness.
|
||||
Defaults to `1`, which means that the current time is checked at
|
||||
most once per millisecond.
|
||||
|
||||
Set to `0` to check the current time every time staleness is
|
||||
tested.
|
||||
|
||||
Note that setting this to a higher value _will_ improve
|
||||
performance somewhat while using ttl tracking, albeit at the
|
||||
expense of keeping stale items around a bit longer than intended.
|
||||
|
||||
### `ttlAutopurge`
|
||||
|
||||
Preemptively remove stale items from the cache.
|
||||
|
||||
Note that this may _significantly_ degrade performance,
|
||||
especially if the cache is storing a large number of items. It
|
||||
is almost always best to just leave the stale items in the cache,
|
||||
and let them fall out as new items are added.
|
||||
|
||||
Note that this means that `allowStale` is a bit pointless, as
|
||||
stale items will be deleted almost as soon as they expire.
|
||||
|
||||
Use with caution!
|
||||
|
||||
Boolean, default `false`
|
||||
|
||||
### `allowStale`
|
||||
|
||||
By default, if you set `ttl`, it'll only delete stale items from
|
||||
the cache when you `get(key)`. That is, it's not preemptively
|
||||
pruning items.
|
||||
|
||||
If you set `allowStale:true`, it'll return the stale value as
|
||||
well as deleting it. If you don't set this, then it'll return
|
||||
`undefined` when you try to get a stale entry.
|
||||
|
||||
Note that when a stale entry is fetched, _even if it is returned
|
||||
due to `allowStale` being set_, it is removed from the cache
|
||||
immediately. You can immediately put it back in the cache if you
|
||||
wish, thus resetting the TTL.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`. The `cache.has()` method will always return
|
||||
`false` for stale items.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `noDeleteOnStaleGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, by default stale
|
||||
items will be removed from the cache when the key is accessed
|
||||
with `cache.get()`.
|
||||
|
||||
Setting `noDeleteOnStaleGet` to `true` will cause stale items to
|
||||
remain in the cache, until they are explicitly deleted with
|
||||
`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
|
||||
to `false`.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever it is
|
||||
retrieved from cache with `get()`, causing it to not expire. (It
|
||||
can still fall out of cache based on recency of use, of course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnHas`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever its presence
|
||||
in the cache is checked with `has()`, causing it to not expire.
|
||||
(It can still fall out of cache based on recency of use, of
|
||||
course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.has()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
## API
|
||||
|
||||
### `new LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new LRUCache. All options are documented above, and are
|
||||
on the cache as public members.
|
||||
|
||||
The `K` and `V` types define the key and value types,
|
||||
respectively. The optional `FC` type defines the type of the
|
||||
`context` object passed to `cache.fetch()`.
|
||||
|
||||
Keys and values **must not** be `null` or `undefined`.
|
||||
|
||||
### `cache.max`, `cache.maxSize`, `cache.allowStale`,
|
||||
|
||||
`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
|
||||
`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
|
||||
`cache.updateAgeOnHas`
|
||||
|
||||
All option names are exposed as public members on the cache
|
||||
object.
|
||||
|
||||
These are intended for read access only. Changing them during
|
||||
program operation can cause undefined behavior.
|
||||
|
||||
### `cache.size`
|
||||
|
||||
The total number of items held in the cache at the current
|
||||
moment.
|
||||
|
||||
### `cache.calculatedSize`
|
||||
|
||||
The total size of items in cache when using size tracking.
|
||||
|
||||
### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
|
||||
|
||||
Add a value to the cache.
|
||||
|
||||
Optional options object may contain `ttl` and `sizeCalculation`
|
||||
as described above, which default to the settings on the cache
|
||||
object.
|
||||
|
||||
If `start` is provided, then that will set the effective start
|
||||
time for the TTL calculation. Note that this must be a previous
|
||||
value of `performance.now()` if supported, or a previous value of
|
||||
`Date.now()` if not.
|
||||
|
||||
Options object may also include `size`, which will prevent
|
||||
calling the `sizeCalculation` function and just use the specified
|
||||
number if it is a positive integer, and `noDisposeOnSet` which
|
||||
will prevent calling a `dispose` function in the case of
|
||||
overwrites.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
Will update the recency of the entry.
|
||||
|
||||
Returns the cache object.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
If the value is `undefined`, then this is an alias for
|
||||
`cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
See **Storing Undefined Values** below.
|
||||
|
||||
### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
|
||||
|
||||
Return a value from the cache.
|
||||
|
||||
Will update the recency of the cache entry found.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `info(key) => Entry | undefined`
|
||||
|
||||
Return an `Entry` object containing the currently cached value,
|
||||
as well as ttl and size information if available. Returns
|
||||
undefined if the key is not found in the cache.
|
||||
|
||||
Unlike `dump()` (which is designed to be portable and survive
|
||||
serialization), the `start` value is always the current
|
||||
timestamp, and the `ttl` is a calculated remaining time to live
|
||||
(negative if expired).
|
||||
|
||||
Note that stale values are always returned, rather than being
|
||||
pruned and treated as if they were not in the cache. If you wish
|
||||
to exclude stale entries, guard against a negative `ttl` value.
|
||||
|
||||
### `async fetch(key, options = {}) => Promise`
|
||||
|
||||
The following options are supported:
|
||||
|
||||
- `updateAgeOnGet`
|
||||
- `allowStale`
|
||||
- `size`
|
||||
- `sizeCalculation`
|
||||
- `ttl`
|
||||
- `noDisposeOnSet`
|
||||
- `forceRefresh`
|
||||
- `status` - See **Status Tracking** below.
|
||||
- `signal` - AbortSignal can be used to cancel the `fetch()`.
|
||||
Note that the `signal` option provided to the `fetchMethod` is
|
||||
a different object, because it must also respond to internal
|
||||
cache state changes, but aborting this signal will abort the
|
||||
one passed to `fetchMethod` as well.
|
||||
- `context` - sets the `context` option passed to the underlying
|
||||
`fetchMethod`.
|
||||
|
||||
If the value is in the cache and not stale, then the returned
|
||||
Promise resolves to the value.
|
||||
|
||||
If not in the cache, or beyond its TTL staleness, then
|
||||
`fetchMethod(key, staleValue, { options, signal, context })` is
|
||||
called, and the value returned will be added to the cache once
|
||||
resolved.
|
||||
|
||||
If called with `allowStale`, and an asynchronous fetch is
|
||||
currently in progress to reload a stale value, then the former
|
||||
stale value will be returned.
|
||||
|
||||
If called with `forceRefresh`, then the cached item will be
|
||||
re-fetched, even if it is not stale. However, if `allowStale` is
|
||||
set, then the old value will still be returned. This is useful
|
||||
in cases where you want to force a reload of a cached value. If
|
||||
a background fetch is already in progress, then `forceRefresh`
|
||||
has no effect.
|
||||
|
||||
Multiple fetches for the same `key` will only call `fetchMethod`
|
||||
a single time, and all will be resolved when the value is
|
||||
resolved, even if different options are used.
|
||||
|
||||
If `fetchMethod` is not specified, then this is effectively an
|
||||
alias for `Promise.resolve(cache.get(key))`.
|
||||
|
||||
When the fetch method resolves to a value, if the fetch has not
|
||||
been aborted due to deletion, eviction, or being overwritten,
|
||||
then it is added to the cache using the options provided.
|
||||
|
||||
If the key is evicted or deleted before the `fetchMethod`
|
||||
resolves, then the AbortSignal passed to the `fetchMethod` will
|
||||
receive an `abort` event, and the promise returned by `fetch()`
|
||||
will reject with the reason for the abort.
|
||||
|
||||
If a `signal` is passed to the `fetch()` call, then aborting the
|
||||
signal will abort the fetch and cause the `fetch()` promise to
|
||||
reject with the reason provided.
|
||||
|
||||
#### Setting `context`
|
||||
|
||||
If an `FC` type is set to a type other than `unknown`, `void`, or
|
||||
`undefined` in the LRUCache constructor, then all
|
||||
calls to `cache.fetch()` _must_ provide a `context` option. If
|
||||
set to `undefined` or `void`, then calls to fetch _must not_
|
||||
provide a `context` option.
|
||||
|
||||
The `context` param allows you to provide arbitrary data that
|
||||
might be relevant in the course of fetching the data. It is only
|
||||
relevant for the course of a single `fetch()` operation, and
|
||||
discarded afterwards.
|
||||
|
||||
#### Note: `fetch()` calls are inflight-unique
|
||||
|
||||
If you call `fetch()` multiple times with the same key value,
|
||||
then every call after the first will resolve on the same
|
||||
promise<sup>1</sup>,
|
||||
_even if they have different settings that would otherwise change
|
||||
the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
|
||||
or `ignoreFetchAbort`.
|
||||
|
||||
In most cases, this is not a problem (in fact, only fetching
|
||||
something once is what you probably want, if you're caching in
|
||||
the first place). If you are changing the fetch() options
|
||||
dramatically between runs, there's a good chance that you might
|
||||
be trying to fit divergent semantics into a single object, and
|
||||
would be better off with multiple cache instances.
|
||||
|
||||
**1**: Ie, they're not the "same Promise", but they resolve at
|
||||
the same time, because they're both waiting on the same
|
||||
underlying fetchMethod response.
|
||||
|
||||
### `peek(key, { allowStale } = {}) => value`
|
||||
|
||||
Like `get()` but doesn't update recency or delete stale items.
|
||||
|
||||
Returns `undefined` if the item is stale, unless `allowStale` is
|
||||
set either on the cache or in the options object.
|
||||
|
||||
### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
|
||||
|
||||
Check if a key is in the cache, without updating the recency of
|
||||
use. Age is updated if `updateAgeOnHas` is set to `true` in
|
||||
either the options or the constructor.
|
||||
|
||||
Will return `false` if the item is stale, even though it is
|
||||
technically in the cache. The difference can be determined (if
|
||||
it matters) by using a `status` argument, and inspecting the
|
||||
`has` field.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
Returns `true` if the key was deleted, `false` otherwise.
|
||||
|
||||
### `clear()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
### `keys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rkeys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `values()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from most recently used to least recently used.
|
||||
|
||||
### `rvalues()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from least recently used to most recently used.
|
||||
|
||||
### `entries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rentries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `find(fn, [getOptions])`
|
||||
|
||||
Find a value for which the supplied `fn` method returns a truthy
|
||||
value, similar to `Array.find()`.
|
||||
|
||||
`fn` is called as `fn(value, key, cache)`.
|
||||
|
||||
The optional `getOptions` are applied to the resulting `get()` of
|
||||
the item found.
|
||||
|
||||
### `dump()`
|
||||
|
||||
Return an array of `[key, entry]` objects which can be passed to
|
||||
`cache.load()`
|
||||
|
||||
The `start` fields are calculated relative to a portable
|
||||
`Date.now()` timestamp, even if `performance.now()` is available.
|
||||
|
||||
Stale entries are always included in the `dump`, even if
|
||||
`allowStale` is false.
|
||||
|
||||
Note: this returns an actual array, not a generator, so it can be
|
||||
more easily passed around.
|
||||
|
||||
### `load(entries)`
|
||||
|
||||
Reset the cache and load in the items in `entries` in the order
|
||||
listed. Note that the shape of the resulting cache may be
|
||||
different if the same options are not used in both caches.
|
||||
|
||||
The `start` fields are assumed to be calculated relative to a
|
||||
portable `Date.now()` timestamp, even if `performance.now()` is
|
||||
available.
|
||||
|
||||
### `purgeStale()`
|
||||
|
||||
Delete any stale entries. Returns `true` if anything was
|
||||
removed, `false` otherwise.
|
||||
|
||||
### `getRemainingTTL(key)`
|
||||
|
||||
Return the number of ms left in the item's TTL. If item is not
|
||||
in cache, returns `0`. Returns `Infinity` if item is in cache
|
||||
without a defined TTL.
|
||||
|
||||
### `forEach(fn, [thisp])`
|
||||
|
||||
Call the `fn` function with each set of `fn(value, key, cache)`
|
||||
in the LRU cache, from most recent to least recently used.
|
||||
|
||||
Does not affect recency of use.
|
||||
|
||||
If `thisp` is provided, function will be called in the
|
||||
`this`-context of the provided object.
|
||||
|
||||
### `rforEach(fn, [thisp])`
|
||||
|
||||
Same as `cache.forEach(fn, thisp)`, but in order from least
|
||||
recently used to most recently used.
|
||||
|
||||
### `pop()`
|
||||
|
||||
Evict the least recently used item, returning its value.
|
||||
|
||||
Returns `undefined` if cache is empty.
|
||||
|
||||
## Status Tracking
|
||||
|
||||
Occasionally, it may be useful to track the internal behavior of
|
||||
the cache, particularly for logging, debugging, or for behavior
|
||||
within the `fetchMethod`. To do this, you can pass a `status`
|
||||
object to the `get()`, `set()`, `has()`, and `fetch()` methods.
|
||||
|
||||
The `status` option should be a plain JavaScript object.
|
||||
|
||||
The following fields will be set appropriately:
|
||||
|
||||
```ts
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
* - add: the item was not found in the cache, and was added
|
||||
* - update: the item was in the cache, with the same value provided
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss'
|
||||
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
ttl?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the start time for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
start?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The timestamp used for TTL calculation
|
||||
*/
|
||||
now?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the remaining ttl for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
remainingTTL?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The calculated size for the item, if sizes are used.
|
||||
*/
|
||||
size?: LRUSize
|
||||
|
||||
/**
|
||||
* A flag indicating that the item was not stored, due to exceeding the
|
||||
* {@link maxEntrySize}
|
||||
*/
|
||||
maxEntrySizeExceeded?: true
|
||||
|
||||
/**
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V
|
||||
|
||||
/**
|
||||
* The results of a {@link has} operation
|
||||
*
|
||||
* - hit: the item was found in the cache
|
||||
* - stale: the item was found in the cache, but is stale
|
||||
* - miss: the item was not found in the cache
|
||||
*/
|
||||
has?: 'hit' | 'stale' | 'miss'
|
||||
|
||||
/**
|
||||
* The status of a {@link fetch} operation.
|
||||
* Note that this can change as the underlying fetch() moves through
|
||||
* various states.
|
||||
*
|
||||
* - inflight: there is another fetch() for this key which is in process
|
||||
* - get: there is no fetchMethod, so {@link get} was called.
|
||||
* - miss: the item is not in cache, and will be fetched.
|
||||
* - hit: the item is in the cache, and was resolved immediately.
|
||||
* - stale: the item is in the cache, but stale.
|
||||
* - refresh: the item is in the cache, and not stale, but
|
||||
* {@link forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
|
||||
|
||||
/**
|
||||
* The {@link fetchMethod} was called
|
||||
*/
|
||||
fetchDispatched?: true
|
||||
|
||||
/**
|
||||
* The cached value was updated after a successful call to fetchMethod
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The reason for a fetch() rejection. Either the error raised by the
|
||||
* {@link fetchMethod}, or the reason for an AbortSignal.
|
||||
*/
|
||||
fetchError?: Error
|
||||
|
||||
/**
|
||||
* The fetch received an abort signal
|
||||
*/
|
||||
fetchAborted?: true
|
||||
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise resolved successfully
|
||||
*/
|
||||
fetchResolved?: true
|
||||
|
||||
/**
|
||||
* The results of the fetchMethod promise were stored in the cache
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise was rejected
|
||||
*/
|
||||
fetchRejected?: true
|
||||
|
||||
/**
|
||||
* The status of a {@link get} operation.
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value is
|
||||
* present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss'
|
||||
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true
|
||||
}
|
||||
```
|
||||
For full description of the API and all options, please see [the
|
||||
LRUCache typedocs](https://isaacs.github.io/node-lru-cache/)
|
||||
|
||||
## Storage Bounds Safety
|
||||
|
||||
|
@ -1066,7 +186,7 @@ This cache never stores undefined values, as `undefined` is used
|
|||
internally in a few places to indicate that a key is not in the
|
||||
cache.
|
||||
|
||||
You may call `cache.set(key, undefined)`, but this is just an
|
||||
You may call `cache.set(key, undefined)`, but this is just
|
||||
an alias for `cache.delete(key)`. Note that this has the effect
|
||||
that `cache.has(key)` will return _false_ after setting it to
|
||||
undefined.
|
||||
|
@ -1195,10 +315,17 @@ before, it probably will not work in version 7 and above.
|
|||
- Minified export available at `'lru-cache/min'`, for both CJS
|
||||
and MJS builds.
|
||||
|
||||
## Changes in Version 9
|
||||
## Breaking Changes in Version 9
|
||||
|
||||
- Named export only, no default export.
|
||||
- AbortController polyfill returned, albeit with a warning when
|
||||
used.
|
||||
|
||||
## Breaking Changes in Version 10
|
||||
|
||||
- `cache.fetch()` return type is now `Promise<V | undefined>`
|
||||
instead of `Promise<V | void>`. This is an irrelevant change
|
||||
practically speaking, but can require changes for TypeScript
|
||||
users.
|
||||
|
||||
For more info, see the [change log](CHANGELOG.md).
|
||||
|
|
54
components/documenteditor/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
54
components/documenteditor/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
|
@ -13,7 +13,7 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of
|
|||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made in <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
|
|
57
components/documenteditor/node_modules/simple-odata-server/README.md
сгенерированный
поставляемый
57
components/documenteditor/node_modules/simple-odata-server/README.md
сгенерированный
поставляемый
|
@ -1,10 +1,7 @@
|
|||
⚠️ This repository isn't being maintained. It's stable and still used in [jsreport](https://github.com/jsreport/jsreport), but we are too busy to provide adequate maintenance. Don't hesitate to let me know if you plan to maintain a fork so I can share it here..
|
||||
--
|
||||
|
||||
# Node simple OData server
|
||||
#Node simple OData server
|
||||
[![NPM Version](http://img.shields.io/npm/v/simple-odata-server.svg?style=flat-square)](https://npmjs.com/package/simple-odata-server)
|
||||
[![License](http://img.shields.io/npm/l/simple-odata-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![build status](https://github.com/pofider/node-simple-odata-server/actions/workflows/main.yml/badge.svg)](https://github.com/pofider/node-simple-odata-server/actions)
|
||||
[![Build Status](https://travis-ci.org/pofider/node-simple-odata-server.png?branch=master)](https://travis-ci.org/pofider/node-simple-odata-server)
|
||||
|
||||
**Super simple implementation of OData server running on Node.js with easy adapters for mongodb and nedb.** Just define an OData model, provide a mongo or nedb database, hook into node.js http server and run.
|
||||
|
||||
|
@ -12,15 +9,14 @@ It supports basic operations you would expect like providing $metadata, filterin
|
|||
|
||||
The implementation is tested with [.net OData client](https://github.com/object/Simple.OData.Client) and it should fulfill basic protocol requirements.
|
||||
|
||||
## Get started
|
||||
##Get started
|
||||
|
||||
This is how you can create an OData server with node.js http module and nedb.
|
||||
```js
|
||||
var http = require('http');
|
||||
var Datastore = require('nedb');
|
||||
var db = new Datastore( { inMemoryOnly: true });
|
||||
var ODataServer = require('simple-odata-server');
|
||||
var Adapter = require('simple-odata-server-nedb');
|
||||
var ODataServer = require("simple-odata-server");
|
||||
|
||||
var model = {
|
||||
namespace: "jsreport",
|
||||
|
@ -39,7 +35,7 @@ var model = {
|
|||
|
||||
var odataServer = ODataServer("http://localhost:1337")
|
||||
.model(model)
|
||||
.adapter(Adapter(function(es, cb) { cb(null, db)}));
|
||||
.onNeDB(function(es, cb) { cb(null, db)});
|
||||
|
||||
|
||||
http.createServer(odataServer.handle.bind(odataServer)).listen(1337);
|
||||
|
@ -53,47 +49,32 @@ GET [http://localhost:1337/users?$orderby=test desc]()<br/>
|
|||
GET [http://localhost:1337/users/$count]()<br/>
|
||||
POST, PATCH, DELETE
|
||||
|
||||
## Adapters
|
||||
There are currently two adapters implemented.
|
||||
|
||||
- [mongodb](https://www.mongodb.com/) - [pofider/node-simple-odata-server-mongodb](https://github.com/pofider/node-simple-odata-server-mongodb)
|
||||
- [nedb](https://github.com/louischatriot/nedb) - [pofider/node-simple-odata-server-nedb](https://github.com/pofider/node-simple-odata-server-nedb)
|
||||
|
||||
The `mongo` adapter can be used as
|
||||
##mongodb
|
||||
It works the same way with nedb and mongo. You just need to provide callback for mongo database instance.
|
||||
```js
|
||||
var Adapter = require('simple-odata-server-mongodb')
|
||||
MongoClient.connect(url, function(err, db) {
|
||||
odataServer.adapter(Adapter(function(cb) {
|
||||
cb(err, db.db('myodatadb'));
|
||||
}));
|
||||
odataServer.onMongo(function(cb) { cb(err, db); });
|
||||
});
|
||||
```
|
||||
|
||||
## express.js
|
||||
##express.js
|
||||
It works well also with the express.js. You even don't need to provide service uri in the `ODataServer` constructor because it is taken from the express.js request.
|
||||
|
||||
```js
|
||||
app.use("/odata", function (req, res) {
|
||||
odataServer.handle(req, res);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## cors
|
||||
You can quickly set up cors without using express and middlewares using this call
|
||||
|
||||
```js
|
||||
odataServer.cors('*')
|
||||
```
|
||||
|
||||
## Configurations
|
||||
Using existing `adapter` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
##Configurations
|
||||
Using `onNeDB` and `onMongo` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
|
||||
```js
|
||||
odataServer
|
||||
.query(fn(setName, query, req, cb))
|
||||
.update(fn(setName, query, update, req, cb))
|
||||
.insert(fn(setName, doc, req, cb))
|
||||
.remove(fn(setName, query, req, cb))
|
||||
.query(fn(setName, query, cb))
|
||||
.update(fn(setName, query, update, cb))
|
||||
.insert(fn(setName, doc, cb))
|
||||
.remove(fn(setName, query, cb))
|
||||
.beforeQuery(fn(setName, query, req, cb))
|
||||
.beforeUpdate(fn(setName, query, req, update))
|
||||
.beforeInsert(fn(setName, doc, req, cb))
|
||||
|
@ -105,16 +86,16 @@ odataServer
|
|||
|
||||
|
||||
|
||||
## Contributions
|
||||
##Contributions
|
||||
I will maintain this repository for a while because I use it in [jsreport](https://github.com/jsreport/jsreport). You are more than welcome to contribute with pull requests and add other basic operations you require.
|
||||
|
||||
## Limitations
|
||||
##Limitations
|
||||
- document ids must have name **_id**
|
||||
- no entity links
|
||||
- no batch operations
|
||||
- no validations
|
||||
- ... this would be a very long list, so rather check yourself
|
||||
|
||||
## License
|
||||
##License
|
||||
See [license](https://github.com/pofider/node-simple-odata-server/blob/master/LICENSE)
|
||||
|
||||
|
|
113
components/documenteditor/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
113
components/documenteditor/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,113 @@
|
|||
# lodash v3.0.1
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
$ lodash modularize modern exports=node -o ./
|
||||
$ lodash modern -d -o ./index.js
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
// load the modern build
|
||||
var _ = require('lodash');
|
||||
// or a method category
|
||||
var array = require('lodash/array');
|
||||
// or a method
|
||||
var chunk = require('lodash/array/chunk');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.0.1-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
|
||||
Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default.
|
||||
|
||||
## Module formats
|
||||
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build
|
||||
|
||||
## Further Reading
|
||||
|
||||
* [API Documentation](https://lodash.com/docs)
|
||||
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
|
||||
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
|
||||
* [Release Notes](https://github.com/lodash/lodash/releases)
|
||||
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
|
||||
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
|
||||
|
||||
## Features *not* in Underscore
|
||||
|
||||
* ~100% [code coverage](https://coveralls.io/r/lodash)
|
||||
* Follows [semantic versioning](http://semver.org/) for releases
|
||||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining
|
||||
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining
|
||||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order
|
||||
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
|
||||
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch
|
||||
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after)
|
||||
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size
|
||||
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||
* [_.create](https://lodash.com/docs#create) for easier object inheritance
|
||||
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions
|
||||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control
|
||||
* [_.findIndex](https://lodash.com/docs#findIndex) & [_.findKey](https://lodash.com/docs#findKey) for finding indexes & keys
|
||||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#vlowRight) (a.k.a `_.compose`)
|
||||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
|
||||
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
|
||||
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
|
||||
* [_.includes](https://lodash.com/docs#includes) accepts a `fromIndex`
|
||||
* [_.isError](https://lodash.com/docs#isError) to check for error objects
|
||||
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
|
||||
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
|
||||
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays
|
||||
* [_.keysIn](https://lodash.com/docs#keysIn) & [_.valuesIn](https://lodash.com/docs#valuesIn) for getting keys & values of all enumerable properties
|
||||
* [_.mapValues](https://lodash.com/docs#mapValues) for [mapping](https://lodash.com/docs#map) values to an object
|
||||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
|
||||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior
|
||||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays
|
||||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
|
||||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking
|
||||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values
|
||||
* [_.sortByAll](https://lodash.com/docs#sortBy) for sorting by multiple properties
|
||||
* [_.support](https://lodash.com/docs#support) for flagging environment features
|
||||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
|
||||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
|
||||
* [_.thru](https://lodash.com/docs#thru) to pass values thru method chains
|
||||
* [_.where](https://lodash.com/docs#where) supports deep object comparisons
|
||||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
|
||||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), &
|
||||
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders
|
||||
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), &
|
||||
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods
|
||||
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), &
|
||||
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks
|
||||
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), &
|
||||
[more](https://lodash.com/docs "_.drop, _.dropRightWhile, _.take, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest)
|
||||
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastIndex](https://lodash.com/docs#findLastIndex), &
|
||||
[more](https://lodash.com/docs "_.findLastKey, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods
|
||||
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), &
|
||||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 25-26, Safari 5-8, io.js 1.0.4, Node.js 0.8.28 & 0.10.35, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.
|
||||
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
|
186
components/documenteditor/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
186
components/documenteditor/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
|
@ -1,103 +1,83 @@
|
|||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](https://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
|
||||
[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js)
|
||||
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)
|
||||
|
||||
### Announcing `xmlbuilder2`:
|
||||
|
||||
The new release of `xmlbuilder` is available at [`xmlbuilder2`](https://github.com/oozcitak/xmlbuilder2)! `xmlbuilder2` has been redesigned from the ground up to be fully conforming to the [modern DOM specification](https://dom.spec.whatwg.org). It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see [upgrading from xmlbuilder](https://oozcitak.github.io/xmlbuilder2/upgrading-from-xmlbuilder.html) in the wiki.
|
||||
|
||||
New development will be focused towards `xmlbuilder2`; `xmlbuilder` will only receive critical bug fixes.
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder')
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder>
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var obj = {
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
repo: {
|
||||
'@type': 'git', // attributes start with @
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var xml = builder.create(obj).end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
|
||||
var xml = root.end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details and [examples](https://github.com/oozcitak/xmlbuilder-js/wiki/Examples) for more complex examples.
|
||||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](http://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![NPM version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.org/package/xmlbuilder)
|
||||
[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![Dependency Status](http://img.shields.io/david/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder', {'for': 'node-js'})
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder for="node-js">
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
builder.create({
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
'@for': 'node-js', // attributes start with @
|
||||
repo: {
|
||||
'@type': 'git',
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // #text denotes element text
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-documenteditor",
|
||||
"version": "26.1.38",
|
||||
"version": "26.1.39",
|
||||
"description": "Feature-rich document editor control with built-in support for context menu, options pane and dialogs. for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
|
@ -2,6 +2,20 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### DropDownTree
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I605241` - An issue with change event in the Dropdown Tree component has been resolved.
|
||||
|
||||
### MultiSelect
|
||||
|
||||
#### Bug Fixes
|
||||
|
||||
- `#I580914` - Fixed issue with MultiSelect CheckBox mode and large dataset causing page unresponsiveness.
|
||||
|
||||
## 26.1.39 (2024-06-25)
|
||||
|
||||
### ListBox
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 22 Jun 2024 07:35:32 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1647.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1651.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
2
components/dropdowns/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
2
components/dropdowns/node_modules/glob/node_modules/minimatch/README.md
сгенерированный
поставляемый
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
|
@ -6,16 +6,8 @@
|
|||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP verbs that Node.js core's HTTP parser supports.
|
||||
HTTP verbs that node core's parser supports.
|
||||
|
||||
This module provides an export that is just like `http.METHODS` from Node.js core,
|
||||
with the following differences:
|
||||
|
||||
* All method names are lower-cased.
|
||||
* Contains a fallback list of methods for Node.js versions that do not have a
|
||||
`http.METHODS` export (0.10 and lower).
|
||||
* Provides the fallback list when using tools like `browserify` without pulling
|
||||
in the `http` shim module.
|
||||
|
||||
## Install
|
||||
|
||||
|
@ -31,9 +23,7 @@ var methods = require('methods')
|
|||
|
||||
### methods
|
||||
|
||||
This is an array of lower-cased method names that Node.js supports. If Node.js
|
||||
provides the `http.METHODS` export, then this is the same array lower-cased,
|
||||
otherwise it is a snapshot of the verbs from Node.js 0.10.
|
||||
This is an array of lower-case method names that Node.js supports.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -42,7 +32,7 @@ otherwise it is a snapshot of the verbs from Node.js 0.10.
|
|||
[npm-image]: https://img.shields.io/npm/v/methods.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/methods
|
||||
[node-version-image]: https://img.shields.io/node/v/methods.svg?style=flat
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/methods.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/methods
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/methods.svg?style=flat
|
||||
|
|
|
@ -88,16 +88,4 @@ restuls in:
|
|||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Issue Reporting
|
||||
|
||||
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
||||
|
||||
## Author
|
||||
|
||||
[Auth0](auth0.com)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
||||
```
|
895
components/dropdowns/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
895
components/dropdowns/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
|
@ -102,888 +102,8 @@ cache.clear() // empty the cache
|
|||
If you put more stuff in the cache, then less recently used items
|
||||
will fall out. That's what an LRU cache is.
|
||||
|
||||
## `class LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new `LRUCache` object.
|
||||
|
||||
When using TypeScript, set the `K` and `V` types to the `key` and
|
||||
`value` types, respectively.
|
||||
|
||||
The `FC` ("fetch context") generic type defaults to `unknown`.
|
||||
If set to a value other than `void` or `undefined`, then any
|
||||
calls to `cache.fetch()` _must_ provide a `context` option
|
||||
matching the `FC` type. If `FC` is set to `void` or `undefined`,
|
||||
then `cache.fetch()` _must not_ provide a `context` option. See
|
||||
the documentation on `async fetch()` below.
|
||||
|
||||
## Options
|
||||
|
||||
All options are available on the LRUCache instance, making it
|
||||
safe to pass an LRUCache instance as the options argument to make
|
||||
another empty cache of the same type.
|
||||
|
||||
Some options are marked read-only because changing them after
|
||||
instantiation is not safe. Changing any of the other options
|
||||
will of course only have an effect on subsequent method calls.
|
||||
|
||||
### `max` (read only)
|
||||
|
||||
The maximum number of items that remain in the cache (assuming no
|
||||
TTL pruning or explicit deletions). Note that fewer items may be
|
||||
stored if size calculation is used, and `maxSize` is exceeded.
|
||||
This must be a positive finite intger.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
**It is strongly recommended to set a `max` to prevent unbounded
|
||||
growth of the cache.** See "Storage Bounds Safety" below.
|
||||
|
||||
### `maxSize` (read only)
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and automatically evict items in order to stay below
|
||||
this size. Note that this may result in fewer than `max` items
|
||||
being stored.
|
||||
|
||||
Attempting to add an item to the cache whose calculated size is
|
||||
greater that this amount will be a no-op. The item will not be
|
||||
cached, and no other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided.
|
||||
|
||||
Sets `maxEntrySize` to the same value, unless a different value
|
||||
is provided for `maxEntrySize`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if size tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
### `maxEntrySize`
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and prevent caching any item over a given size.
|
||||
Attempting to add an item whose calculated size is greater than
|
||||
this amount will be a no-op. The item will not be cached, and no
|
||||
other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided. Defaults to
|
||||
the value of `maxSize` if provided.
|
||||
|
||||
### `sizeCalculation`
|
||||
|
||||
Function used to calculate the size of stored items. If you're
|
||||
storing strings or buffers, then you probably want to do
|
||||
something like `n => n.length`. The item is passed as the first
|
||||
argument, and the key is passed as the second argument.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Requires `maxSize` to be set.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
### `fetchMethod` (read only)
|
||||
|
||||
Function that is used to make background asynchronous fetches.
|
||||
Called with `fetchMethod(key, staleValue, { signal, options,
|
||||
context })`. May return a Promise.
|
||||
|
||||
If `fetchMethod` is not provided, then `cache.fetch(key)` is
|
||||
equivalent to `Promise.resolve(cache.get(key))`.
|
||||
|
||||
If at any time, `signal.aborted` is set to `true`, or if the
|
||||
`signal.onabort` method is called, or if it emits an `'abort'`
|
||||
event which you can listen to with `addEventListener`, then that
|
||||
means that the fetch should be abandoned. This may be passed
|
||||
along to async functions aware of AbortController/AbortSignal
|
||||
behavior.
|
||||
|
||||
The `fetchMethod` should **only** return `undefined` or a Promise
|
||||
resolving to `undefined` if the AbortController signaled an
|
||||
`abort` event. In all other cases, it should return or resolve
|
||||
to a value suitable for adding to the cache.
|
||||
|
||||
The `options` object is a union of the options that may be
|
||||
provided to `set()` and `get()`. If they are modified, then that
|
||||
will result in modifying the settings to `cache.set()` when the
|
||||
value is resolved, and in the case of `noDeleteOnFetchRejection`
|
||||
and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
|
||||
failures.
|
||||
|
||||
For example, a DNS cache may update the TTL based on the value
|
||||
returned from a remote DNS server by changing `options.ttl` in
|
||||
the `fetchMethod`.
|
||||
|
||||
### `noDeleteOnFetchRejection`
|
||||
|
||||
If a `fetchMethod` throws an error or returns a rejected promise,
|
||||
then by default, any existing stale value will be removed from
|
||||
the cache.
|
||||
|
||||
If `noDeleteOnFetchRejection` is set to `true`, then this
|
||||
behavior is suppressed, and the stale value remains in the cache
|
||||
in the case of a rejected `fetchMethod`.
|
||||
|
||||
This is important in cases where a `fetchMethod` is _only_ called
|
||||
as a background update while the stale value is returned, when
|
||||
`allowStale` is used.
|
||||
|
||||
This is implicitly in effect when `allowStaleOnFetchRejection` is
|
||||
set.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchRejection`
|
||||
|
||||
Set to true to return a stale value from the cache when a
|
||||
`fetchMethod` throws an error or returns a rejected Promise.
|
||||
|
||||
If a `fetchMethod` fails, and there is no stale value available,
|
||||
the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
|
||||
errors are suppressed.
|
||||
|
||||
Implies `noDeleteOnFetchRejection`.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchAbort`
|
||||
|
||||
Set to true to return a stale value from the cache when the
|
||||
`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
|
||||
event, whether user-triggered, or due to internal cache behavior.
|
||||
|
||||
Unless `ignoreFetchAbort` is also set, the underlying
|
||||
`fetchMethod` will still be considered canceled, and any value
|
||||
it returns will be ignored and not cached.
|
||||
|
||||
Caveat: since fetches are aborted when a new value is explicitly
|
||||
set in the cache, this can lead to fetch returning a stale value,
|
||||
since that was the fallback value _at the moment the `fetch()` was
|
||||
initiated_, even though the new updated value is now present in
|
||||
the cache.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const cache = new LRUCache<string, any>({
|
||||
ttl: 100,
|
||||
fetchMethod: async (url, oldValue, { signal }) => {
|
||||
const res = await fetch(url, { signal })
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
cache.set('https://example.com/', { some: 'data' })
|
||||
// 100ms go by...
|
||||
const result = cache.fetch('https://example.com/')
|
||||
cache.set('https://example.com/', { other: 'thing' })
|
||||
console.log(await result) // { some: 'data' }
|
||||
console.log(cache.get('https://example.com/')) // { other: 'thing' }
|
||||
```
|
||||
|
||||
### `ignoreFetchAbort`
|
||||
|
||||
Set to true to ignore the `abort` event emitted by the
|
||||
`AbortSignal` object passed to `fetchMethod`, and still cache the
|
||||
resulting resolution value, as long as it is not `undefined`.
|
||||
|
||||
When used on its own, this means aborted `fetch()` calls are not
|
||||
immediately resolved or rejected when they are aborted, and
|
||||
instead take the full time to await.
|
||||
|
||||
When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
|
||||
will resolve immediately to their stale cached value or
|
||||
`undefined`, and will continue to process and eventually update
|
||||
the cache when they resolve, as long as the resulting value is
|
||||
not `undefined`, thus supporting a "return stale on timeout while
|
||||
refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
|
||||
signal.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const c = new LRUCache({
|
||||
ttl: 100,
|
||||
ignoreFetchAbort: true,
|
||||
allowStaleOnFetchAbort: true,
|
||||
fetchMethod: async (key, oldValue, { signal }) => {
|
||||
// note: do NOT pass the signal to fetch()!
|
||||
// let's say this fetch can take a long time.
|
||||
const res = await fetch(`https://slow-backend-server/${key}`)
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
// this will return the stale value after 100ms, while still
|
||||
// updating in the background for next time.
|
||||
const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
|
||||
```
|
||||
|
||||
**Note**: regardless of this setting, an `abort` event _is still
|
||||
emitted on the `AbortSignal` object_, so may result in invalid
|
||||
results when passed to other underlying APIs that use
|
||||
AbortSignals.
|
||||
|
||||
This may be overridden on the `fetch()` call or in the
|
||||
`fetchMethod` itself.
|
||||
|
||||
### `dispose` (read only)
|
||||
|
||||
Function that is called on items when they are dropped from the
|
||||
cache, as `this.dispose(value, key, reason)`.
|
||||
|
||||
This can be handy if you want to close file descriptors or do
|
||||
other cleanup tasks when items are no longer stored in the cache.
|
||||
|
||||
**NOTE**: It is called _before_ the item has been fully removed
|
||||
from the cache, so if you want to put it right back in, you need
|
||||
to wait until the next tick. If you try to add it back in during
|
||||
the `dispose()` function call, it will break things in subtle and
|
||||
weird ways.
|
||||
|
||||
Unlike several other options, this may _not_ be overridden by
|
||||
passing an option to `set()`, for performance reasons.
|
||||
|
||||
The `reason` will be one of the following strings, corresponding
|
||||
to the reason for the item's deletion:
|
||||
|
||||
- `evict` Item was evicted to make space for a new addition
|
||||
- `set` Item was overwritten by a new value
|
||||
- `delete` Item was removed by explicit `cache.delete(key)` or by
|
||||
calling `cache.clear()`, which deletes everything.
|
||||
|
||||
The `dispose()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
Optional, must be a function.
|
||||
|
||||
### `disposeAfter` (read only)
|
||||
|
||||
The same as `dispose`, but called _after_ the entry is completely
|
||||
removed and the cache is once again in a clean state.
|
||||
|
||||
It is safe to add an item right back into the cache at this
|
||||
point. However, note that it is _very_ easy to inadvertently
|
||||
create infinite recursion in this way.
|
||||
|
||||
The `disposeAfter()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
### `noDisposeOnSet`
|
||||
|
||||
Set to `true` to suppress calling the `dispose()` function if the
|
||||
entry key is still accessible within the cache.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Boolean, default `false`. Only relevant if `dispose` or
|
||||
`disposeAfter` options are set.
|
||||
|
||||
### `ttl`
|
||||
|
||||
Max time to live for items before they are considered stale.
|
||||
Note that stale items are NOT preemptively removed by default,
|
||||
and MAY live in the cache, contributing to its LRU max, long
|
||||
after they have expired.
|
||||
|
||||
Also, as this cache is optimized for LRU/MRU operations, some of
|
||||
the staleness/TTL checks will reduce performance.
|
||||
|
||||
This is not primarily a TTL cache, and does not make strong TTL
|
||||
guarantees. There is no pre-emptive pruning of expired items,
|
||||
but you _may_ set a TTL on the cache, and it will treat expired
|
||||
items as missing when they are fetched, and delete them.
|
||||
|
||||
Optional, but must be a positive integer in ms if specified.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if ttl tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
If ttl tracking is enabled, and `max` and `maxSize` are not set,
|
||||
and `ttlAutopurge` is not set, then a warning will be emitted
|
||||
cautioning about the potential for unbounded memory consumption.
|
||||
(The TypeScript definitions will also discourage this.)
|
||||
|
||||
### `noUpdateTTL`
|
||||
|
||||
Boolean flag to tell the cache to not update the TTL when setting
|
||||
a new value for an existing key (ie, when updating a value rather
|
||||
than inserting a new value). Note that the TTL value is _always_
|
||||
set (if provided) when adding a new entry into the cache.
|
||||
|
||||
This may be passed as an option to `cache.set()`.
|
||||
|
||||
Boolean, default false.
|
||||
|
||||
### `ttlResolution`
|
||||
|
||||
Minimum amount of time in ms in which to check for staleness.
|
||||
Defaults to `1`, which means that the current time is checked at
|
||||
most once per millisecond.
|
||||
|
||||
Set to `0` to check the current time every time staleness is
|
||||
tested.
|
||||
|
||||
Note that setting this to a higher value _will_ improve
|
||||
performance somewhat while using ttl tracking, albeit at the
|
||||
expense of keeping stale items around a bit longer than intended.
|
||||
|
||||
### `ttlAutopurge`
|
||||
|
||||
Preemptively remove stale items from the cache.
|
||||
|
||||
Note that this may _significantly_ degrade performance,
|
||||
especially if the cache is storing a large number of items. It
|
||||
is almost always best to just leave the stale items in the cache,
|
||||
and let them fall out as new items are added.
|
||||
|
||||
Note that this means that `allowStale` is a bit pointless, as
|
||||
stale items will be deleted almost as soon as they expire.
|
||||
|
||||
Use with caution!
|
||||
|
||||
Boolean, default `false`
|
||||
|
||||
### `allowStale`
|
||||
|
||||
By default, if you set `ttl`, it'll only delete stale items from
|
||||
the cache when you `get(key)`. That is, it's not preemptively
|
||||
pruning items.
|
||||
|
||||
If you set `allowStale:true`, it'll return the stale value as
|
||||
well as deleting it. If you don't set this, then it'll return
|
||||
`undefined` when you try to get a stale entry.
|
||||
|
||||
Note that when a stale entry is fetched, _even if it is returned
|
||||
due to `allowStale` being set_, it is removed from the cache
|
||||
immediately. You can immediately put it back in the cache if you
|
||||
wish, thus resetting the TTL.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`. The `cache.has()` method will always return
|
||||
`false` for stale items.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `noDeleteOnStaleGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, by default stale
|
||||
items will be removed from the cache when the key is accessed
|
||||
with `cache.get()`.
|
||||
|
||||
Setting `noDeleteOnStaleGet` to `true` will cause stale items to
|
||||
remain in the cache, until they are explicitly deleted with
|
||||
`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
|
||||
to `false`.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever it is
|
||||
retrieved from cache with `get()`, causing it to not expire. (It
|
||||
can still fall out of cache based on recency of use, of course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnHas`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever its presence
|
||||
in the cache is checked with `has()`, causing it to not expire.
|
||||
(It can still fall out of cache based on recency of use, of
|
||||
course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.has()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
## API
|
||||
|
||||
### `new LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new LRUCache. All options are documented above, and are
|
||||
on the cache as public members.
|
||||
|
||||
The `K` and `V` types define the key and value types,
|
||||
respectively. The optional `FC` type defines the type of the
|
||||
`context` object passed to `cache.fetch()`.
|
||||
|
||||
Keys and values **must not** be `null` or `undefined`.
|
||||
|
||||
### `cache.max`, `cache.maxSize`, `cache.allowStale`,
|
||||
|
||||
`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
|
||||
`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
|
||||
`cache.updateAgeOnHas`
|
||||
|
||||
All option names are exposed as public members on the cache
|
||||
object.
|
||||
|
||||
These are intended for read access only. Changing them during
|
||||
program operation can cause undefined behavior.
|
||||
|
||||
### `cache.size`
|
||||
|
||||
The total number of items held in the cache at the current
|
||||
moment.
|
||||
|
||||
### `cache.calculatedSize`
|
||||
|
||||
The total size of items in cache when using size tracking.
|
||||
|
||||
### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
|
||||
|
||||
Add a value to the cache.
|
||||
|
||||
Optional options object may contain `ttl` and `sizeCalculation`
|
||||
as described above, which default to the settings on the cache
|
||||
object.
|
||||
|
||||
If `start` is provided, then that will set the effective start
|
||||
time for the TTL calculation. Note that this must be a previous
|
||||
value of `performance.now()` if supported, or a previous value of
|
||||
`Date.now()` if not.
|
||||
|
||||
Options object may also include `size`, which will prevent
|
||||
calling the `sizeCalculation` function and just use the specified
|
||||
number if it is a positive integer, and `noDisposeOnSet` which
|
||||
will prevent calling a `dispose` function in the case of
|
||||
overwrites.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
Will update the recency of the entry.
|
||||
|
||||
Returns the cache object.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
If the value is `undefined`, then this is an alias for
|
||||
`cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
See **Storing Undefined Values** below.
|
||||
|
||||
### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
|
||||
|
||||
Return a value from the cache.
|
||||
|
||||
Will update the recency of the cache entry found.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `info(key) => Entry | undefined`
|
||||
|
||||
Return an `Entry` object containing the currently cached value,
|
||||
as well as ttl and size information if available. Returns
|
||||
undefined if the key is not found in the cache.
|
||||
|
||||
Unlike `dump()` (which is designed to be portable and survive
|
||||
serialization), the `start` value is always the current
|
||||
timestamp, and the `ttl` is a calculated remaining time to live
|
||||
(negative if expired).
|
||||
|
||||
Note that stale values are always returned, rather than being
|
||||
pruned and treated as if they were not in the cache. If you wish
|
||||
to exclude stale entries, guard against a negative `ttl` value.
|
||||
|
||||
### `async fetch(key, options = {}) => Promise`
|
||||
|
||||
The following options are supported:
|
||||
|
||||
- `updateAgeOnGet`
|
||||
- `allowStale`
|
||||
- `size`
|
||||
- `sizeCalculation`
|
||||
- `ttl`
|
||||
- `noDisposeOnSet`
|
||||
- `forceRefresh`
|
||||
- `status` - See **Status Tracking** below.
|
||||
- `signal` - AbortSignal can be used to cancel the `fetch()`.
|
||||
Note that the `signal` option provided to the `fetchMethod` is
|
||||
a different object, because it must also respond to internal
|
||||
cache state changes, but aborting this signal will abort the
|
||||
one passed to `fetchMethod` as well.
|
||||
- `context` - sets the `context` option passed to the underlying
|
||||
`fetchMethod`.
|
||||
|
||||
If the value is in the cache and not stale, then the returned
|
||||
Promise resolves to the value.
|
||||
|
||||
If not in the cache, or beyond its TTL staleness, then
|
||||
`fetchMethod(key, staleValue, { options, signal, context })` is
|
||||
called, and the value returned will be added to the cache once
|
||||
resolved.
|
||||
|
||||
If called with `allowStale`, and an asynchronous fetch is
|
||||
currently in progress to reload a stale value, then the former
|
||||
stale value will be returned.
|
||||
|
||||
If called with `forceRefresh`, then the cached item will be
|
||||
re-fetched, even if it is not stale. However, if `allowStale` is
|
||||
set, then the old value will still be returned. This is useful
|
||||
in cases where you want to force a reload of a cached value. If
|
||||
a background fetch is already in progress, then `forceRefresh`
|
||||
has no effect.
|
||||
|
||||
Multiple fetches for the same `key` will only call `fetchMethod`
|
||||
a single time, and all will be resolved when the value is
|
||||
resolved, even if different options are used.
|
||||
|
||||
If `fetchMethod` is not specified, then this is effectively an
|
||||
alias for `Promise.resolve(cache.get(key))`.
|
||||
|
||||
When the fetch method resolves to a value, if the fetch has not
|
||||
been aborted due to deletion, eviction, or being overwritten,
|
||||
then it is added to the cache using the options provided.
|
||||
|
||||
If the key is evicted or deleted before the `fetchMethod`
|
||||
resolves, then the AbortSignal passed to the `fetchMethod` will
|
||||
receive an `abort` event, and the promise returned by `fetch()`
|
||||
will reject with the reason for the abort.
|
||||
|
||||
If a `signal` is passed to the `fetch()` call, then aborting the
|
||||
signal will abort the fetch and cause the `fetch()` promise to
|
||||
reject with the reason provided.
|
||||
|
||||
#### Setting `context`
|
||||
|
||||
If an `FC` type is set to a type other than `unknown`, `void`, or
|
||||
`undefined` in the LRUCache constructor, then all
|
||||
calls to `cache.fetch()` _must_ provide a `context` option. If
|
||||
set to `undefined` or `void`, then calls to fetch _must not_
|
||||
provide a `context` option.
|
||||
|
||||
The `context` param allows you to provide arbitrary data that
|
||||
might be relevant in the course of fetching the data. It is only
|
||||
relevant for the course of a single `fetch()` operation, and
|
||||
discarded afterwards.
|
||||
|
||||
#### Note: `fetch()` calls are inflight-unique
|
||||
|
||||
If you call `fetch()` multiple times with the same key value,
|
||||
then every call after the first will resolve on the same
|
||||
promise<sup>1</sup>,
|
||||
_even if they have different settings that would otherwise change
|
||||
the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
|
||||
or `ignoreFetchAbort`.
|
||||
|
||||
In most cases, this is not a problem (in fact, only fetching
|
||||
something once is what you probably want, if you're caching in
|
||||
the first place). If you are changing the fetch() options
|
||||
dramatically between runs, there's a good chance that you might
|
||||
be trying to fit divergent semantics into a single object, and
|
||||
would be better off with multiple cache instances.
|
||||
|
||||
**1**: Ie, they're not the "same Promise", but they resolve at
|
||||
the same time, because they're both waiting on the same
|
||||
underlying fetchMethod response.
|
||||
|
||||
### `peek(key, { allowStale } = {}) => value`
|
||||
|
||||
Like `get()` but doesn't update recency or delete stale items.
|
||||
|
||||
Returns `undefined` if the item is stale, unless `allowStale` is
|
||||
set either on the cache or in the options object.
|
||||
|
||||
### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
|
||||
|
||||
Check if a key is in the cache, without updating the recency of
|
||||
use. Age is updated if `updateAgeOnHas` is set to `true` in
|
||||
either the options or the constructor.
|
||||
|
||||
Will return `false` if the item is stale, even though it is
|
||||
technically in the cache. The difference can be determined (if
|
||||
it matters) by using a `status` argument, and inspecting the
|
||||
`has` field.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
Returns `true` if the key was deleted, `false` otherwise.
|
||||
|
||||
### `clear()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
### `keys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rkeys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `values()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from most recently used to least recently used.
|
||||
|
||||
### `rvalues()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from least recently used to most recently used.
|
||||
|
||||
### `entries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rentries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `find(fn, [getOptions])`
|
||||
|
||||
Find a value for which the supplied `fn` method returns a truthy
|
||||
value, similar to `Array.find()`.
|
||||
|
||||
`fn` is called as `fn(value, key, cache)`.
|
||||
|
||||
The optional `getOptions` are applied to the resulting `get()` of
|
||||
the item found.
|
||||
|
||||
### `dump()`
|
||||
|
||||
Return an array of `[key, entry]` objects which can be passed to
|
||||
`cache.load()`
|
||||
|
||||
The `start` fields are calculated relative to a portable
|
||||
`Date.now()` timestamp, even if `performance.now()` is available.
|
||||
|
||||
Stale entries are always included in the `dump`, even if
|
||||
`allowStale` is false.
|
||||
|
||||
Note: this returns an actual array, not a generator, so it can be
|
||||
more easily passed around.
|
||||
|
||||
### `load(entries)`
|
||||
|
||||
Reset the cache and load in the items in `entries` in the order
|
||||
listed. Note that the shape of the resulting cache may be
|
||||
different if the same options are not used in both caches.
|
||||
|
||||
The `start` fields are assumed to be calculated relative to a
|
||||
portable `Date.now()` timestamp, even if `performance.now()` is
|
||||
available.
|
||||
|
||||
### `purgeStale()`
|
||||
|
||||
Delete any stale entries. Returns `true` if anything was
|
||||
removed, `false` otherwise.
|
||||
|
||||
### `getRemainingTTL(key)`
|
||||
|
||||
Return the number of ms left in the item's TTL. If item is not
|
||||
in cache, returns `0`. Returns `Infinity` if item is in cache
|
||||
without a defined TTL.
|
||||
|
||||
### `forEach(fn, [thisp])`
|
||||
|
||||
Call the `fn` function with each set of `fn(value, key, cache)`
|
||||
in the LRU cache, from most recent to least recently used.
|
||||
|
||||
Does not affect recency of use.
|
||||
|
||||
If `thisp` is provided, function will be called in the
|
||||
`this`-context of the provided object.
|
||||
|
||||
### `rforEach(fn, [thisp])`
|
||||
|
||||
Same as `cache.forEach(fn, thisp)`, but in order from least
|
||||
recently used to most recently used.
|
||||
|
||||
### `pop()`
|
||||
|
||||
Evict the least recently used item, returning its value.
|
||||
|
||||
Returns `undefined` if cache is empty.
|
||||
|
||||
## Status Tracking
|
||||
|
||||
Occasionally, it may be useful to track the internal behavior of
|
||||
the cache, particularly for logging, debugging, or for behavior
|
||||
within the `fetchMethod`. To do this, you can pass a `status`
|
||||
object to the `get()`, `set()`, `has()`, and `fetch()` methods.
|
||||
|
||||
The `status` option should be a plain JavaScript object.
|
||||
|
||||
The following fields will be set appropriately:
|
||||
|
||||
```ts
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
* - add: the item was not found in the cache, and was added
|
||||
* - update: the item was in the cache, with the same value provided
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss'
|
||||
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
ttl?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the start time for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
start?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The timestamp used for TTL calculation
|
||||
*/
|
||||
now?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the remaining ttl for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
remainingTTL?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The calculated size for the item, if sizes are used.
|
||||
*/
|
||||
size?: LRUSize
|
||||
|
||||
/**
|
||||
* A flag indicating that the item was not stored, due to exceeding the
|
||||
* {@link maxEntrySize}
|
||||
*/
|
||||
maxEntrySizeExceeded?: true
|
||||
|
||||
/**
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V
|
||||
|
||||
/**
|
||||
* The results of a {@link has} operation
|
||||
*
|
||||
* - hit: the item was found in the cache
|
||||
* - stale: the item was found in the cache, but is stale
|
||||
* - miss: the item was not found in the cache
|
||||
*/
|
||||
has?: 'hit' | 'stale' | 'miss'
|
||||
|
||||
/**
|
||||
* The status of a {@link fetch} operation.
|
||||
* Note that this can change as the underlying fetch() moves through
|
||||
* various states.
|
||||
*
|
||||
* - inflight: there is another fetch() for this key which is in process
|
||||
* - get: there is no fetchMethod, so {@link get} was called.
|
||||
* - miss: the item is not in cache, and will be fetched.
|
||||
* - hit: the item is in the cache, and was resolved immediately.
|
||||
* - stale: the item is in the cache, but stale.
|
||||
* - refresh: the item is in the cache, and not stale, but
|
||||
* {@link forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
|
||||
|
||||
/**
|
||||
* The {@link fetchMethod} was called
|
||||
*/
|
||||
fetchDispatched?: true
|
||||
|
||||
/**
|
||||
* The cached value was updated after a successful call to fetchMethod
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The reason for a fetch() rejection. Either the error raised by the
|
||||
* {@link fetchMethod}, or the reason for an AbortSignal.
|
||||
*/
|
||||
fetchError?: Error
|
||||
|
||||
/**
|
||||
* The fetch received an abort signal
|
||||
*/
|
||||
fetchAborted?: true
|
||||
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise resolved successfully
|
||||
*/
|
||||
fetchResolved?: true
|
||||
|
||||
/**
|
||||
* The results of the fetchMethod promise were stored in the cache
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise was rejected
|
||||
*/
|
||||
fetchRejected?: true
|
||||
|
||||
/**
|
||||
* The status of a {@link get} operation.
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value is
|
||||
* present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss'
|
||||
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true
|
||||
}
|
||||
```
|
||||
For full description of the API and all options, please see [the
|
||||
LRUCache typedocs](https://isaacs.github.io/node-lru-cache/)
|
||||
|
||||
## Storage Bounds Safety
|
||||
|
||||
|
@ -1066,7 +186,7 @@ This cache never stores undefined values, as `undefined` is used
|
|||
internally in a few places to indicate that a key is not in the
|
||||
cache.
|
||||
|
||||
You may call `cache.set(key, undefined)`, but this is just an
|
||||
You may call `cache.set(key, undefined)`, but this is just
|
||||
an alias for `cache.delete(key)`. Note that this has the effect
|
||||
that `cache.has(key)` will return _false_ after setting it to
|
||||
undefined.
|
||||
|
@ -1195,10 +315,17 @@ before, it probably will not work in version 7 and above.
|
|||
- Minified export available at `'lru-cache/min'`, for both CJS
|
||||
and MJS builds.
|
||||
|
||||
## Changes in Version 9
|
||||
## Breaking Changes in Version 9
|
||||
|
||||
- Named export only, no default export.
|
||||
- AbortController polyfill returned, albeit with a warning when
|
||||
used.
|
||||
|
||||
## Breaking Changes in Version 10
|
||||
|
||||
- `cache.fetch()` return type is now `Promise<V | undefined>`
|
||||
instead of `Promise<V | void>`. This is an irrelevant change
|
||||
practically speaking, but can require changes for TypeScript
|
||||
users.
|
||||
|
||||
For more info, see the [change log](CHANGELOG.md).
|
||||
|
|
54
components/dropdowns/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
54
components/dropdowns/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
|
@ -13,7 +13,7 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of
|
|||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made in <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
⚠️ This repository isn't being maintained. It's stable and still used in [jsreport](https://github.com/jsreport/jsreport), but we are too busy to provide adequate maintenance. Don't hesitate to let me know if you plan to maintain a fork so I can share it here..
|
||||
--
|
||||
|
||||
# Node simple OData server
|
||||
#Node simple OData server
|
||||
[![NPM Version](http://img.shields.io/npm/v/simple-odata-server.svg?style=flat-square)](https://npmjs.com/package/simple-odata-server)
|
||||
[![License](http://img.shields.io/npm/l/simple-odata-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![build status](https://github.com/pofider/node-simple-odata-server/actions/workflows/main.yml/badge.svg)](https://github.com/pofider/node-simple-odata-server/actions)
|
||||
[![Build Status](https://travis-ci.org/pofider/node-simple-odata-server.png?branch=master)](https://travis-ci.org/pofider/node-simple-odata-server)
|
||||
|
||||
**Super simple implementation of OData server running on Node.js with easy adapters for mongodb and nedb.** Just define an OData model, provide a mongo or nedb database, hook into node.js http server and run.
|
||||
|
||||
|
@ -12,15 +9,14 @@ It supports basic operations you would expect like providing $metadata, filterin
|
|||
|
||||
The implementation is tested with [.net OData client](https://github.com/object/Simple.OData.Client) and it should fulfill basic protocol requirements.
|
||||
|
||||
## Get started
|
||||
##Get started
|
||||
|
||||
This is how you can create an OData server with node.js http module and nedb.
|
||||
```js
|
||||
var http = require('http');
|
||||
var Datastore = require('nedb');
|
||||
var db = new Datastore( { inMemoryOnly: true });
|
||||
var ODataServer = require('simple-odata-server');
|
||||
var Adapter = require('simple-odata-server-nedb');
|
||||
var ODataServer = require("simple-odata-server");
|
||||
|
||||
var model = {
|
||||
namespace: "jsreport",
|
||||
|
@ -39,7 +35,7 @@ var model = {
|
|||
|
||||
var odataServer = ODataServer("http://localhost:1337")
|
||||
.model(model)
|
||||
.adapter(Adapter(function(es, cb) { cb(null, db)}));
|
||||
.onNeDB(function(es, cb) { cb(null, db)});
|
||||
|
||||
|
||||
http.createServer(odataServer.handle.bind(odataServer)).listen(1337);
|
||||
|
@ -53,47 +49,32 @@ GET [http://localhost:1337/users?$orderby=test desc]()<br/>
|
|||
GET [http://localhost:1337/users/$count]()<br/>
|
||||
POST, PATCH, DELETE
|
||||
|
||||
## Adapters
|
||||
There are currently two adapters implemented.
|
||||
|
||||
- [mongodb](https://www.mongodb.com/) - [pofider/node-simple-odata-server-mongodb](https://github.com/pofider/node-simple-odata-server-mongodb)
|
||||
- [nedb](https://github.com/louischatriot/nedb) - [pofider/node-simple-odata-server-nedb](https://github.com/pofider/node-simple-odata-server-nedb)
|
||||
|
||||
The `mongo` adapter can be used as
|
||||
##mongodb
|
||||
It works the same way with nedb and mongo. You just need to provide callback for mongo database instance.
|
||||
```js
|
||||
var Adapter = require('simple-odata-server-mongodb')
|
||||
MongoClient.connect(url, function(err, db) {
|
||||
odataServer.adapter(Adapter(function(cb) {
|
||||
cb(err, db.db('myodatadb'));
|
||||
}));
|
||||
odataServer.onMongo(function(cb) { cb(err, db); });
|
||||
});
|
||||
```
|
||||
|
||||
## express.js
|
||||
##express.js
|
||||
It works well also with the express.js. You even don't need to provide service uri in the `ODataServer` constructor because it is taken from the express.js request.
|
||||
|
||||
```js
|
||||
app.use("/odata", function (req, res) {
|
||||
odataServer.handle(req, res);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## cors
|
||||
You can quickly set up cors without using express and middlewares using this call
|
||||
|
||||
```js
|
||||
odataServer.cors('*')
|
||||
```
|
||||
|
||||
## Configurations
|
||||
Using existing `adapter` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
##Configurations
|
||||
Using `onNeDB` and `onMongo` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
|
||||
```js
|
||||
odataServer
|
||||
.query(fn(setName, query, req, cb))
|
||||
.update(fn(setName, query, update, req, cb))
|
||||
.insert(fn(setName, doc, req, cb))
|
||||
.remove(fn(setName, query, req, cb))
|
||||
.query(fn(setName, query, cb))
|
||||
.update(fn(setName, query, update, cb))
|
||||
.insert(fn(setName, doc, cb))
|
||||
.remove(fn(setName, query, cb))
|
||||
.beforeQuery(fn(setName, query, req, cb))
|
||||
.beforeUpdate(fn(setName, query, req, update))
|
||||
.beforeInsert(fn(setName, doc, req, cb))
|
||||
|
@ -105,16 +86,16 @@ odataServer
|
|||
|
||||
|
||||
|
||||
## Contributions
|
||||
##Contributions
|
||||
I will maintain this repository for a while because I use it in [jsreport](https://github.com/jsreport/jsreport). You are more than welcome to contribute with pull requests and add other basic operations you require.
|
||||
|
||||
## Limitations
|
||||
##Limitations
|
||||
- document ids must have name **_id**
|
||||
- no entity links
|
||||
- no batch operations
|
||||
- no validations
|
||||
- ... this would be a very long list, so rather check yourself
|
||||
|
||||
## License
|
||||
##License
|
||||
See [license](https://github.com/pofider/node-simple-odata-server/blob/master/LICENSE)
|
||||
|
||||
|
|
113
components/dropdowns/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
113
components/dropdowns/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,113 @@
|
|||
# lodash v3.0.1
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
$ lodash modularize modern exports=node -o ./
|
||||
$ lodash modern -d -o ./index.js
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
// load the modern build
|
||||
var _ = require('lodash');
|
||||
// or a method category
|
||||
var array = require('lodash/array');
|
||||
// or a method
|
||||
var chunk = require('lodash/array/chunk');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.0.1-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
|
||||
Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default.
|
||||
|
||||
## Module formats
|
||||
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build
|
||||
|
||||
## Further Reading
|
||||
|
||||
* [API Documentation](https://lodash.com/docs)
|
||||
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
|
||||
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
|
||||
* [Release Notes](https://github.com/lodash/lodash/releases)
|
||||
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
|
||||
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
|
||||
|
||||
## Features *not* in Underscore
|
||||
|
||||
* ~100% [code coverage](https://coveralls.io/r/lodash)
|
||||
* Follows [semantic versioning](http://semver.org/) for releases
|
||||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining
|
||||
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining
|
||||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order
|
||||
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
|
||||
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch
|
||||
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after)
|
||||
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size
|
||||
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||
* [_.create](https://lodash.com/docs#create) for easier object inheritance
|
||||
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions
|
||||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control
|
||||
* [_.findIndex](https://lodash.com/docs#findIndex) & [_.findKey](https://lodash.com/docs#findKey) for finding indexes & keys
|
||||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#vlowRight) (a.k.a `_.compose`)
|
||||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
|
||||
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
|
||||
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
|
||||
* [_.includes](https://lodash.com/docs#includes) accepts a `fromIndex`
|
||||
* [_.isError](https://lodash.com/docs#isError) to check for error objects
|
||||
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
|
||||
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
|
||||
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays
|
||||
* [_.keysIn](https://lodash.com/docs#keysIn) & [_.valuesIn](https://lodash.com/docs#valuesIn) for getting keys & values of all enumerable properties
|
||||
* [_.mapValues](https://lodash.com/docs#mapValues) for [mapping](https://lodash.com/docs#map) values to an object
|
||||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
|
||||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior
|
||||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays
|
||||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
|
||||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking
|
||||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values
|
||||
* [_.sortByAll](https://lodash.com/docs#sortBy) for sorting by multiple properties
|
||||
* [_.support](https://lodash.com/docs#support) for flagging environment features
|
||||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
|
||||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
|
||||
* [_.thru](https://lodash.com/docs#thru) to pass values thru method chains
|
||||
* [_.where](https://lodash.com/docs#where) supports deep object comparisons
|
||||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
|
||||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), &
|
||||
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders
|
||||
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), &
|
||||
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods
|
||||
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), &
|
||||
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks
|
||||
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), &
|
||||
[more](https://lodash.com/docs "_.drop, _.dropRightWhile, _.take, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest)
|
||||
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastIndex](https://lodash.com/docs#findLastIndex), &
|
||||
[more](https://lodash.com/docs "_.findLastKey, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods
|
||||
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), &
|
||||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 25-26, Safari 5-8, io.js 1.0.4, Node.js 0.8.28 & 0.10.35, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.
|
||||
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
|
186
components/dropdowns/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
186
components/dropdowns/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
|
@ -1,103 +1,83 @@
|
|||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](https://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
|
||||
[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js)
|
||||
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)
|
||||
|
||||
### Announcing `xmlbuilder2`:
|
||||
|
||||
The new release of `xmlbuilder` is available at [`xmlbuilder2`](https://github.com/oozcitak/xmlbuilder2)! `xmlbuilder2` has been redesigned from the ground up to be fully conforming to the [modern DOM specification](https://dom.spec.whatwg.org). It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see [upgrading from xmlbuilder](https://oozcitak.github.io/xmlbuilder2/upgrading-from-xmlbuilder.html) in the wiki.
|
||||
|
||||
New development will be focused towards `xmlbuilder2`; `xmlbuilder` will only receive critical bug fixes.
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder')
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder>
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var obj = {
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
repo: {
|
||||
'@type': 'git', // attributes start with @
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var xml = builder.create(obj).end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
|
||||
var xml = root.end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details and [examples](https://github.com/oozcitak/xmlbuilder-js/wiki/Examples) for more complex examples.
|
||||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](http://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![NPM version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.org/package/xmlbuilder)
|
||||
[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![Dependency Status](http://img.shields.io/david/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder', {'for': 'node-js'})
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder for="node-js">
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
builder.create({
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
'@for': 'node-js', // attributes start with @
|
||||
repo: {
|
||||
'@type': 'git',
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // #text denotes element text
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-dropdowns",
|
||||
"version": "26.1.38",
|
||||
"version": "26.1.39",
|
||||
"description": "Essential JS 2 DropDown Components for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
|
@ -2,6 +2,16 @@
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## 26.1.40 (2024-07-02)
|
||||
|
||||
### GanttChart
|
||||
|
||||
#### Bug fixes
|
||||
|
||||
- `#I605424` - `ValidationRules` property not working properly issue has been fixed.
|
||||
- `#I599788` - Duration column is not working properly when using `editType` as `numericedit` issue has been fixed.
|
||||
- `#I603492` - `CollapseAll` / `ExpandAll` button in is not working properly when virtualization is enabled issue has been fixed.
|
||||
|
||||
## 26.1.39 (2024-06-25)
|
||||
|
||||
### GanttChart
|
||||
|
|
6
components/gantt/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
6
components/gantt/node_modules/@axe-core/playwright/node_modules/playwright/README.md
сгенерированный
поставляемый
|
@ -1,6 +1,6 @@
|
|||
# 🎭 Playwright
|
||||
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-125.0.6422.26-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-125.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-127.0.6533.17-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-127.0-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> <!-- GEN:webkit-version-badge -->[![WebKit version](https://img.shields.io/badge/webkit-17.4-blue.svg?logo=safari)](https://webkit.org/)<!-- GEN:stop -->
|
||||
|
||||
## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright)
|
||||
|
||||
|
@ -8,9 +8,9 @@ Playwright is a framework for Web Testing and Automation. It allows testing [Chr
|
|||
|
||||
| | Linux | macOS | Windows |
|
||||
| :--- | :---: | :---: | :---: |
|
||||
| Chromium <!-- GEN:chromium-version -->125.0.6422.26<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->125.0.1<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> | :white_check_mark: | :white_check_mark: | :white_check_mark: |
|
||||
|
||||
Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details.
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ This package contains type definitions for node (https://nodejs.org/).
|
|||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node.
|
||||
|
||||
### Additional Details
|
||||
* Last updated: Sat, 22 Jun 2024 07:35:32 GMT
|
||||
* Last updated: Tue, 25 Jun 2024 22:07:01 GMT
|
||||
* Dependencies: [undici-types](https://npmjs.com/package/undici-types)
|
||||
|
||||
# Credits
|
||||
|
|
|
@ -64,7 +64,7 @@ require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
|||
To use the SDK in the browser, simply add the following script tag to your
|
||||
HTML pages:
|
||||
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1646.0.min.js"></script>
|
||||
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.1651.0.min.js"></script>
|
||||
|
||||
You can also build a custom browser SDK with your specified set of AWS services.
|
||||
This can allow you to reduce the SDK's size, specify different API versions of
|
||||
|
|
|
@ -337,7 +337,7 @@ A number indicating the level of optimization that should be done
|
|||
to the pattern prior to parsing and using it for matches.
|
||||
|
||||
Globstar parts `**` are always converted to `*` when `noglobstar`
|
||||
is set, and multiple adjascent `**` parts are converted into a
|
||||
is set, and multiple adjacent `**` parts are converted into a
|
||||
single `**` (ie, `a/**/**/b` will be treated as `a/**/b`, as this
|
||||
is equivalent in all cases).
|
||||
|
||||
|
|
|
@ -6,16 +6,8 @@
|
|||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP verbs that Node.js core's HTTP parser supports.
|
||||
HTTP verbs that node core's parser supports.
|
||||
|
||||
This module provides an export that is just like `http.METHODS` from Node.js core,
|
||||
with the following differences:
|
||||
|
||||
* All method names are lower-cased.
|
||||
* Contains a fallback list of methods for Node.js versions that do not have a
|
||||
`http.METHODS` export (0.10 and lower).
|
||||
* Provides the fallback list when using tools like `browserify` without pulling
|
||||
in the `http` shim module.
|
||||
|
||||
## Install
|
||||
|
||||
|
@ -31,9 +23,7 @@ var methods = require('methods')
|
|||
|
||||
### methods
|
||||
|
||||
This is an array of lower-cased method names that Node.js supports. If Node.js
|
||||
provides the `http.METHODS` export, then this is the same array lower-cased,
|
||||
otherwise it is a snapshot of the verbs from Node.js 0.10.
|
||||
This is an array of lower-case method names that Node.js supports.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -42,7 +32,7 @@ otherwise it is a snapshot of the verbs from Node.js 0.10.
|
|||
[npm-image]: https://img.shields.io/npm/v/methods.svg?style=flat
|
||||
[npm-url]: https://npmjs.org/package/methods
|
||||
[node-version-image]: https://img.shields.io/node/v/methods.svg?style=flat
|
||||
[node-version-url]: https://nodejs.org/en/download/
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/methods.svg?style=flat
|
||||
[travis-url]: https://travis-ci.org/jshttp/methods
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/methods.svg?style=flat
|
||||
|
|
|
@ -88,16 +88,4 @@ restuls in:
|
|||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Issue Reporting
|
||||
|
||||
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
||||
|
||||
## Author
|
||||
|
||||
[Auth0](auth0.com)
|
||||
|
||||
## License
|
||||
|
||||
This project is licensed under the MIT license. See the [LICENSE](LICENSE) file for more info.
|
||||
```
|
895
components/gantt/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
895
components/gantt/node_modules/path-scurry/node_modules/lru-cache/README.md
сгенерированный
поставляемый
|
@ -102,888 +102,8 @@ cache.clear() // empty the cache
|
|||
If you put more stuff in the cache, then less recently used items
|
||||
will fall out. That's what an LRU cache is.
|
||||
|
||||
## `class LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new `LRUCache` object.
|
||||
|
||||
When using TypeScript, set the `K` and `V` types to the `key` and
|
||||
`value` types, respectively.
|
||||
|
||||
The `FC` ("fetch context") generic type defaults to `unknown`.
|
||||
If set to a value other than `void` or `undefined`, then any
|
||||
calls to `cache.fetch()` _must_ provide a `context` option
|
||||
matching the `FC` type. If `FC` is set to `void` or `undefined`,
|
||||
then `cache.fetch()` _must not_ provide a `context` option. See
|
||||
the documentation on `async fetch()` below.
|
||||
|
||||
## Options
|
||||
|
||||
All options are available on the LRUCache instance, making it
|
||||
safe to pass an LRUCache instance as the options argument to make
|
||||
another empty cache of the same type.
|
||||
|
||||
Some options are marked read-only because changing them after
|
||||
instantiation is not safe. Changing any of the other options
|
||||
will of course only have an effect on subsequent method calls.
|
||||
|
||||
### `max` (read only)
|
||||
|
||||
The maximum number of items that remain in the cache (assuming no
|
||||
TTL pruning or explicit deletions). Note that fewer items may be
|
||||
stored if size calculation is used, and `maxSize` is exceeded.
|
||||
This must be a positive finite intger.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
**It is strongly recommended to set a `max` to prevent unbounded
|
||||
growth of the cache.** See "Storage Bounds Safety" below.
|
||||
|
||||
### `maxSize` (read only)
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and automatically evict items in order to stay below
|
||||
this size. Note that this may result in fewer than `max` items
|
||||
being stored.
|
||||
|
||||
Attempting to add an item to the cache whose calculated size is
|
||||
greater that this amount will be a no-op. The item will not be
|
||||
cached, and no other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided.
|
||||
|
||||
Sets `maxEntrySize` to the same value, unless a different value
|
||||
is provided for `maxEntrySize`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if size tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
### `maxEntrySize`
|
||||
|
||||
Set to a positive integer to track the sizes of items added to
|
||||
the cache, and prevent caching any item over a given size.
|
||||
Attempting to add an item whose calculated size is greater than
|
||||
this amount will be a no-op. The item will not be cached, and no
|
||||
other items will be evicted.
|
||||
|
||||
Optional, must be a positive integer if provided. Defaults to
|
||||
the value of `maxSize` if provided.
|
||||
|
||||
### `sizeCalculation`
|
||||
|
||||
Function used to calculate the size of stored items. If you're
|
||||
storing strings or buffers, then you probably want to do
|
||||
something like `n => n.length`. The item is passed as the first
|
||||
argument, and the key is passed as the second argument.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Requires `maxSize` to be set.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
### `fetchMethod` (read only)
|
||||
|
||||
Function that is used to make background asynchronous fetches.
|
||||
Called with `fetchMethod(key, staleValue, { signal, options,
|
||||
context })`. May return a Promise.
|
||||
|
||||
If `fetchMethod` is not provided, then `cache.fetch(key)` is
|
||||
equivalent to `Promise.resolve(cache.get(key))`.
|
||||
|
||||
If at any time, `signal.aborted` is set to `true`, or if the
|
||||
`signal.onabort` method is called, or if it emits an `'abort'`
|
||||
event which you can listen to with `addEventListener`, then that
|
||||
means that the fetch should be abandoned. This may be passed
|
||||
along to async functions aware of AbortController/AbortSignal
|
||||
behavior.
|
||||
|
||||
The `fetchMethod` should **only** return `undefined` or a Promise
|
||||
resolving to `undefined` if the AbortController signaled an
|
||||
`abort` event. In all other cases, it should return or resolve
|
||||
to a value suitable for adding to the cache.
|
||||
|
||||
The `options` object is a union of the options that may be
|
||||
provided to `set()` and `get()`. If they are modified, then that
|
||||
will result in modifying the settings to `cache.set()` when the
|
||||
value is resolved, and in the case of `noDeleteOnFetchRejection`
|
||||
and `allowStaleOnFetchRejection`, the handling of `fetchMethod`
|
||||
failures.
|
||||
|
||||
For example, a DNS cache may update the TTL based on the value
|
||||
returned from a remote DNS server by changing `options.ttl` in
|
||||
the `fetchMethod`.
|
||||
|
||||
### `noDeleteOnFetchRejection`
|
||||
|
||||
If a `fetchMethod` throws an error or returns a rejected promise,
|
||||
then by default, any existing stale value will be removed from
|
||||
the cache.
|
||||
|
||||
If `noDeleteOnFetchRejection` is set to `true`, then this
|
||||
behavior is suppressed, and the stale value remains in the cache
|
||||
in the case of a rejected `fetchMethod`.
|
||||
|
||||
This is important in cases where a `fetchMethod` is _only_ called
|
||||
as a background update while the stale value is returned, when
|
||||
`allowStale` is used.
|
||||
|
||||
This is implicitly in effect when `allowStaleOnFetchRejection` is
|
||||
set.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchRejection`
|
||||
|
||||
Set to true to return a stale value from the cache when a
|
||||
`fetchMethod` throws an error or returns a rejected Promise.
|
||||
|
||||
If a `fetchMethod` fails, and there is no stale value available,
|
||||
the `fetch()` will resolve to `undefined`. Ie, all `fetchMethod`
|
||||
errors are suppressed.
|
||||
|
||||
Implies `noDeleteOnFetchRejection`.
|
||||
|
||||
This may be set in calls to `fetch()`, or defaulted on the
|
||||
constructor, or overridden by modifying the options object in the
|
||||
`fetchMethod`.
|
||||
|
||||
### `allowStaleOnFetchAbort`
|
||||
|
||||
Set to true to return a stale value from the cache when the
|
||||
`AbortSignal` passed to the `fetchMethod` dispatches an `'abort'`
|
||||
event, whether user-triggered, or due to internal cache behavior.
|
||||
|
||||
Unless `ignoreFetchAbort` is also set, the underlying
|
||||
`fetchMethod` will still be considered canceled, and any value
|
||||
it returns will be ignored and not cached.
|
||||
|
||||
Caveat: since fetches are aborted when a new value is explicitly
|
||||
set in the cache, this can lead to fetch returning a stale value,
|
||||
since that was the fallback value _at the moment the `fetch()` was
|
||||
initiated_, even though the new updated value is now present in
|
||||
the cache.
|
||||
|
||||
For example:
|
||||
|
||||
```ts
|
||||
const cache = new LRUCache<string, any>({
|
||||
ttl: 100,
|
||||
fetchMethod: async (url, oldValue, { signal }) => {
|
||||
const res = await fetch(url, { signal })
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
cache.set('https://example.com/', { some: 'data' })
|
||||
// 100ms go by...
|
||||
const result = cache.fetch('https://example.com/')
|
||||
cache.set('https://example.com/', { other: 'thing' })
|
||||
console.log(await result) // { some: 'data' }
|
||||
console.log(cache.get('https://example.com/')) // { other: 'thing' }
|
||||
```
|
||||
|
||||
### `ignoreFetchAbort`
|
||||
|
||||
Set to true to ignore the `abort` event emitted by the
|
||||
`AbortSignal` object passed to `fetchMethod`, and still cache the
|
||||
resulting resolution value, as long as it is not `undefined`.
|
||||
|
||||
When used on its own, this means aborted `fetch()` calls are not
|
||||
immediately resolved or rejected when they are aborted, and
|
||||
instead take the full time to await.
|
||||
|
||||
When used with `allowStaleOnFetchAbort`, aborted `fetch()` calls
|
||||
will resolve immediately to their stale cached value or
|
||||
`undefined`, and will continue to process and eventually update
|
||||
the cache when they resolve, as long as the resulting value is
|
||||
not `undefined`, thus supporting a "return stale on timeout while
|
||||
refreshing" mechanism by passing `AbortSignal.timeout(n)` as the
|
||||
signal.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
const c = new LRUCache({
|
||||
ttl: 100,
|
||||
ignoreFetchAbort: true,
|
||||
allowStaleOnFetchAbort: true,
|
||||
fetchMethod: async (key, oldValue, { signal }) => {
|
||||
// note: do NOT pass the signal to fetch()!
|
||||
// let's say this fetch can take a long time.
|
||||
const res = await fetch(`https://slow-backend-server/${key}`)
|
||||
return await res.json()
|
||||
},
|
||||
})
|
||||
|
||||
// this will return the stale value after 100ms, while still
|
||||
// updating in the background for next time.
|
||||
const val = await c.fetch('key', { signal: AbortSignal.timeout(100) })
|
||||
```
|
||||
|
||||
**Note**: regardless of this setting, an `abort` event _is still
|
||||
emitted on the `AbortSignal` object_, so may result in invalid
|
||||
results when passed to other underlying APIs that use
|
||||
AbortSignals.
|
||||
|
||||
This may be overridden on the `fetch()` call or in the
|
||||
`fetchMethod` itself.
|
||||
|
||||
### `dispose` (read only)
|
||||
|
||||
Function that is called on items when they are dropped from the
|
||||
cache, as `this.dispose(value, key, reason)`.
|
||||
|
||||
This can be handy if you want to close file descriptors or do
|
||||
other cleanup tasks when items are no longer stored in the cache.
|
||||
|
||||
**NOTE**: It is called _before_ the item has been fully removed
|
||||
from the cache, so if you want to put it right back in, you need
|
||||
to wait until the next tick. If you try to add it back in during
|
||||
the `dispose()` function call, it will break things in subtle and
|
||||
weird ways.
|
||||
|
||||
Unlike several other options, this may _not_ be overridden by
|
||||
passing an option to `set()`, for performance reasons.
|
||||
|
||||
The `reason` will be one of the following strings, corresponding
|
||||
to the reason for the item's deletion:
|
||||
|
||||
- `evict` Item was evicted to make space for a new addition
|
||||
- `set` Item was overwritten by a new value
|
||||
- `delete` Item was removed by explicit `cache.delete(key)` or by
|
||||
calling `cache.clear()`, which deletes everything.
|
||||
|
||||
The `dispose()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
Optional, must be a function.
|
||||
|
||||
### `disposeAfter` (read only)
|
||||
|
||||
The same as `dispose`, but called _after_ the entry is completely
|
||||
removed and the cache is once again in a clean state.
|
||||
|
||||
It is safe to add an item right back into the cache at this
|
||||
point. However, note that it is _very_ easy to inadvertently
|
||||
create infinite recursion in this way.
|
||||
|
||||
The `disposeAfter()` method is _not_ called for canceled calls to
|
||||
`fetchMethod()`. If you wish to handle evictions, overwrites,
|
||||
and deletes of in-flight asynchronous fetches, you must use the
|
||||
`AbortSignal` provided.
|
||||
|
||||
### `noDisposeOnSet`
|
||||
|
||||
Set to `true` to suppress calling the `dispose()` function if the
|
||||
entry key is still accessible within the cache.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
Boolean, default `false`. Only relevant if `dispose` or
|
||||
`disposeAfter` options are set.
|
||||
|
||||
### `ttl`
|
||||
|
||||
Max time to live for items before they are considered stale.
|
||||
Note that stale items are NOT preemptively removed by default,
|
||||
and MAY live in the cache, contributing to its LRU max, long
|
||||
after they have expired.
|
||||
|
||||
Also, as this cache is optimized for LRU/MRU operations, some of
|
||||
the staleness/TTL checks will reduce performance.
|
||||
|
||||
This is not primarily a TTL cache, and does not make strong TTL
|
||||
guarantees. There is no pre-emptive pruning of expired items,
|
||||
but you _may_ set a TTL on the cache, and it will treat expired
|
||||
items as missing when they are fetched, and delete them.
|
||||
|
||||
Optional, but must be a positive integer in ms if specified.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.set()`.
|
||||
|
||||
At least one of `max`, `maxSize`, or `TTL` is required. This
|
||||
must be a positive integer if set.
|
||||
|
||||
Even if ttl tracking is enabled, **it is strongly recommended to
|
||||
set a `max` to prevent unbounded growth of the cache.** See
|
||||
"Storage Bounds Safety" below.
|
||||
|
||||
If ttl tracking is enabled, and `max` and `maxSize` are not set,
|
||||
and `ttlAutopurge` is not set, then a warning will be emitted
|
||||
cautioning about the potential for unbounded memory consumption.
|
||||
(The TypeScript definitions will also discourage this.)
|
||||
|
||||
### `noUpdateTTL`
|
||||
|
||||
Boolean flag to tell the cache to not update the TTL when setting
|
||||
a new value for an existing key (ie, when updating a value rather
|
||||
than inserting a new value). Note that the TTL value is _always_
|
||||
set (if provided) when adding a new entry into the cache.
|
||||
|
||||
This may be passed as an option to `cache.set()`.
|
||||
|
||||
Boolean, default false.
|
||||
|
||||
### `ttlResolution`
|
||||
|
||||
Minimum amount of time in ms in which to check for staleness.
|
||||
Defaults to `1`, which means that the current time is checked at
|
||||
most once per millisecond.
|
||||
|
||||
Set to `0` to check the current time every time staleness is
|
||||
tested.
|
||||
|
||||
Note that setting this to a higher value _will_ improve
|
||||
performance somewhat while using ttl tracking, albeit at the
|
||||
expense of keeping stale items around a bit longer than intended.
|
||||
|
||||
### `ttlAutopurge`
|
||||
|
||||
Preemptively remove stale items from the cache.
|
||||
|
||||
Note that this may _significantly_ degrade performance,
|
||||
especially if the cache is storing a large number of items. It
|
||||
is almost always best to just leave the stale items in the cache,
|
||||
and let them fall out as new items are added.
|
||||
|
||||
Note that this means that `allowStale` is a bit pointless, as
|
||||
stale items will be deleted almost as soon as they expire.
|
||||
|
||||
Use with caution!
|
||||
|
||||
Boolean, default `false`
|
||||
|
||||
### `allowStale`
|
||||
|
||||
By default, if you set `ttl`, it'll only delete stale items from
|
||||
the cache when you `get(key)`. That is, it's not preemptively
|
||||
pruning items.
|
||||
|
||||
If you set `allowStale:true`, it'll return the stale value as
|
||||
well as deleting it. If you don't set this, then it'll return
|
||||
`undefined` when you try to get a stale entry.
|
||||
|
||||
Note that when a stale entry is fetched, _even if it is returned
|
||||
due to `allowStale` being set_, it is removed from the cache
|
||||
immediately. You can immediately put it back in the cache if you
|
||||
wish, thus resetting the TTL.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`. The `cache.has()` method will always return
|
||||
`false` for stale items.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `noDeleteOnStaleGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, by default stale
|
||||
items will be removed from the cache when the key is accessed
|
||||
with `cache.get()`.
|
||||
|
||||
Setting `noDeleteOnStaleGet` to `true` will cause stale items to
|
||||
remain in the cache, until they are explicitly deleted with
|
||||
`cache.delete(key)`, or retrieved with `noDeleteOnStaleGet` set
|
||||
to `false`.
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnGet`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever it is
|
||||
retrieved from cache with `get()`, causing it to not expire. (It
|
||||
can still fall out of cache based on recency of use, of course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.get()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
### `updateAgeOnHas`
|
||||
|
||||
When using time-expiring entries with `ttl`, setting this to
|
||||
`true` will make each item's age reset to 0 whenever its presence
|
||||
in the cache is checked with `has()`, causing it to not expire.
|
||||
(It can still fall out of cache based on recency of use, of
|
||||
course.)
|
||||
|
||||
This may be overridden by passing an options object to
|
||||
`cache.has()`.
|
||||
|
||||
Boolean, default false, only relevant if `ttl` is set.
|
||||
|
||||
## API
|
||||
|
||||
### `new LRUCache<K, V, FC = unknown>(options)`
|
||||
|
||||
Create a new LRUCache. All options are documented above, and are
|
||||
on the cache as public members.
|
||||
|
||||
The `K` and `V` types define the key and value types,
|
||||
respectively. The optional `FC` type defines the type of the
|
||||
`context` object passed to `cache.fetch()`.
|
||||
|
||||
Keys and values **must not** be `null` or `undefined`.
|
||||
|
||||
### `cache.max`, `cache.maxSize`, `cache.allowStale`,
|
||||
|
||||
`cache.noDisposeOnSet`, `cache.sizeCalculation`, `cache.dispose`,
|
||||
`cache.maxSize`, `cache.ttl`, `cache.updateAgeOnGet`,
|
||||
`cache.updateAgeOnHas`
|
||||
|
||||
All option names are exposed as public members on the cache
|
||||
object.
|
||||
|
||||
These are intended for read access only. Changing them during
|
||||
program operation can cause undefined behavior.
|
||||
|
||||
### `cache.size`
|
||||
|
||||
The total number of items held in the cache at the current
|
||||
moment.
|
||||
|
||||
### `cache.calculatedSize`
|
||||
|
||||
The total size of items in cache when using size tracking.
|
||||
|
||||
### `set(key, value, [{ size, sizeCalculation, ttl, noDisposeOnSet, start, status }])`
|
||||
|
||||
Add a value to the cache.
|
||||
|
||||
Optional options object may contain `ttl` and `sizeCalculation`
|
||||
as described above, which default to the settings on the cache
|
||||
object.
|
||||
|
||||
If `start` is provided, then that will set the effective start
|
||||
time for the TTL calculation. Note that this must be a previous
|
||||
value of `performance.now()` if supported, or a previous value of
|
||||
`Date.now()` if not.
|
||||
|
||||
Options object may also include `size`, which will prevent
|
||||
calling the `sizeCalculation` function and just use the specified
|
||||
number if it is a positive integer, and `noDisposeOnSet` which
|
||||
will prevent calling a `dispose` function in the case of
|
||||
overwrites.
|
||||
|
||||
If the `size` (or return value of `sizeCalculation`) for a given
|
||||
entry is greater than `maxEntrySize`, then the item will not be
|
||||
added to the cache.
|
||||
|
||||
Will update the recency of the entry.
|
||||
|
||||
Returns the cache object.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
If the value is `undefined`, then this is an alias for
|
||||
`cache.delete(key)`. `undefined` is never stored in the cache.
|
||||
See **Storing Undefined Values** below.
|
||||
|
||||
### `get(key, { updateAgeOnGet, allowStale, status } = {}) => value`
|
||||
|
||||
Return a value from the cache.
|
||||
|
||||
Will update the recency of the cache entry found.
|
||||
|
||||
If the key is not found, `get()` will return `undefined`.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `info(key) => Entry | undefined`
|
||||
|
||||
Return an `Entry` object containing the currently cached value,
|
||||
as well as ttl and size information if available. Returns
|
||||
undefined if the key is not found in the cache.
|
||||
|
||||
Unlike `dump()` (which is designed to be portable and survive
|
||||
serialization), the `start` value is always the current
|
||||
timestamp, and the `ttl` is a calculated remaining time to live
|
||||
(negative if expired).
|
||||
|
||||
Note that stale values are always returned, rather than being
|
||||
pruned and treated as if they were not in the cache. If you wish
|
||||
to exclude stale entries, guard against a negative `ttl` value.
|
||||
|
||||
### `async fetch(key, options = {}) => Promise`
|
||||
|
||||
The following options are supported:
|
||||
|
||||
- `updateAgeOnGet`
|
||||
- `allowStale`
|
||||
- `size`
|
||||
- `sizeCalculation`
|
||||
- `ttl`
|
||||
- `noDisposeOnSet`
|
||||
- `forceRefresh`
|
||||
- `status` - See **Status Tracking** below.
|
||||
- `signal` - AbortSignal can be used to cancel the `fetch()`.
|
||||
Note that the `signal` option provided to the `fetchMethod` is
|
||||
a different object, because it must also respond to internal
|
||||
cache state changes, but aborting this signal will abort the
|
||||
one passed to `fetchMethod` as well.
|
||||
- `context` - sets the `context` option passed to the underlying
|
||||
`fetchMethod`.
|
||||
|
||||
If the value is in the cache and not stale, then the returned
|
||||
Promise resolves to the value.
|
||||
|
||||
If not in the cache, or beyond its TTL staleness, then
|
||||
`fetchMethod(key, staleValue, { options, signal, context })` is
|
||||
called, and the value returned will be added to the cache once
|
||||
resolved.
|
||||
|
||||
If called with `allowStale`, and an asynchronous fetch is
|
||||
currently in progress to reload a stale value, then the former
|
||||
stale value will be returned.
|
||||
|
||||
If called with `forceRefresh`, then the cached item will be
|
||||
re-fetched, even if it is not stale. However, if `allowStale` is
|
||||
set, then the old value will still be returned. This is useful
|
||||
in cases where you want to force a reload of a cached value. If
|
||||
a background fetch is already in progress, then `forceRefresh`
|
||||
has no effect.
|
||||
|
||||
Multiple fetches for the same `key` will only call `fetchMethod`
|
||||
a single time, and all will be resolved when the value is
|
||||
resolved, even if different options are used.
|
||||
|
||||
If `fetchMethod` is not specified, then this is effectively an
|
||||
alias for `Promise.resolve(cache.get(key))`.
|
||||
|
||||
When the fetch method resolves to a value, if the fetch has not
|
||||
been aborted due to deletion, eviction, or being overwritten,
|
||||
then it is added to the cache using the options provided.
|
||||
|
||||
If the key is evicted or deleted before the `fetchMethod`
|
||||
resolves, then the AbortSignal passed to the `fetchMethod` will
|
||||
receive an `abort` event, and the promise returned by `fetch()`
|
||||
will reject with the reason for the abort.
|
||||
|
||||
If a `signal` is passed to the `fetch()` call, then aborting the
|
||||
signal will abort the fetch and cause the `fetch()` promise to
|
||||
reject with the reason provided.
|
||||
|
||||
#### Setting `context`
|
||||
|
||||
If an `FC` type is set to a type other than `unknown`, `void`, or
|
||||
`undefined` in the LRUCache constructor, then all
|
||||
calls to `cache.fetch()` _must_ provide a `context` option. If
|
||||
set to `undefined` or `void`, then calls to fetch _must not_
|
||||
provide a `context` option.
|
||||
|
||||
The `context` param allows you to provide arbitrary data that
|
||||
might be relevant in the course of fetching the data. It is only
|
||||
relevant for the course of a single `fetch()` operation, and
|
||||
discarded afterwards.
|
||||
|
||||
#### Note: `fetch()` calls are inflight-unique
|
||||
|
||||
If you call `fetch()` multiple times with the same key value,
|
||||
then every call after the first will resolve on the same
|
||||
promise<sup>1</sup>,
|
||||
_even if they have different settings that would otherwise change
|
||||
the behvavior of the fetch_, such as `noDeleteOnFetchRejection`
|
||||
or `ignoreFetchAbort`.
|
||||
|
||||
In most cases, this is not a problem (in fact, only fetching
|
||||
something once is what you probably want, if you're caching in
|
||||
the first place). If you are changing the fetch() options
|
||||
dramatically between runs, there's a good chance that you might
|
||||
be trying to fit divergent semantics into a single object, and
|
||||
would be better off with multiple cache instances.
|
||||
|
||||
**1**: Ie, they're not the "same Promise", but they resolve at
|
||||
the same time, because they're both waiting on the same
|
||||
underlying fetchMethod response.
|
||||
|
||||
### `peek(key, { allowStale } = {}) => value`
|
||||
|
||||
Like `get()` but doesn't update recency or delete stale items.
|
||||
|
||||
Returns `undefined` if the item is stale, unless `allowStale` is
|
||||
set either on the cache or in the options object.
|
||||
|
||||
### `has(key, { updateAgeOnHas, status } = {}) => Boolean`
|
||||
|
||||
Check if a key is in the cache, without updating the recency of
|
||||
use. Age is updated if `updateAgeOnHas` is set to `true` in
|
||||
either the options or the constructor.
|
||||
|
||||
Will return `false` if the item is stale, even though it is
|
||||
technically in the cache. The difference can be determined (if
|
||||
it matters) by using a `status` argument, and inspecting the
|
||||
`has` field.
|
||||
|
||||
For the usage of the `status` option, see **Status Tracking**
|
||||
below.
|
||||
|
||||
### `delete(key)`
|
||||
|
||||
Deletes a key out of the cache.
|
||||
|
||||
Returns `true` if the key was deleted, `false` otherwise.
|
||||
|
||||
### `clear()`
|
||||
|
||||
Clear the cache entirely, throwing away all values.
|
||||
|
||||
### `keys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rkeys()`
|
||||
|
||||
Return a generator yielding the keys in the cache, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `values()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from most recently used to least recently used.
|
||||
|
||||
### `rvalues()`
|
||||
|
||||
Return a generator yielding the values in the cache, in order
|
||||
from least recently used to most recently used.
|
||||
|
||||
### `entries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
most recently used to least recently used.
|
||||
|
||||
### `rentries()`
|
||||
|
||||
Return a generator yielding `[key, value]` pairs, in order from
|
||||
least recently used to most recently used.
|
||||
|
||||
### `find(fn, [getOptions])`
|
||||
|
||||
Find a value for which the supplied `fn` method returns a truthy
|
||||
value, similar to `Array.find()`.
|
||||
|
||||
`fn` is called as `fn(value, key, cache)`.
|
||||
|
||||
The optional `getOptions` are applied to the resulting `get()` of
|
||||
the item found.
|
||||
|
||||
### `dump()`
|
||||
|
||||
Return an array of `[key, entry]` objects which can be passed to
|
||||
`cache.load()`
|
||||
|
||||
The `start` fields are calculated relative to a portable
|
||||
`Date.now()` timestamp, even if `performance.now()` is available.
|
||||
|
||||
Stale entries are always included in the `dump`, even if
|
||||
`allowStale` is false.
|
||||
|
||||
Note: this returns an actual array, not a generator, so it can be
|
||||
more easily passed around.
|
||||
|
||||
### `load(entries)`
|
||||
|
||||
Reset the cache and load in the items in `entries` in the order
|
||||
listed. Note that the shape of the resulting cache may be
|
||||
different if the same options are not used in both caches.
|
||||
|
||||
The `start` fields are assumed to be calculated relative to a
|
||||
portable `Date.now()` timestamp, even if `performance.now()` is
|
||||
available.
|
||||
|
||||
### `purgeStale()`
|
||||
|
||||
Delete any stale entries. Returns `true` if anything was
|
||||
removed, `false` otherwise.
|
||||
|
||||
### `getRemainingTTL(key)`
|
||||
|
||||
Return the number of ms left in the item's TTL. If item is not
|
||||
in cache, returns `0`. Returns `Infinity` if item is in cache
|
||||
without a defined TTL.
|
||||
|
||||
### `forEach(fn, [thisp])`
|
||||
|
||||
Call the `fn` function with each set of `fn(value, key, cache)`
|
||||
in the LRU cache, from most recent to least recently used.
|
||||
|
||||
Does not affect recency of use.
|
||||
|
||||
If `thisp` is provided, function will be called in the
|
||||
`this`-context of the provided object.
|
||||
|
||||
### `rforEach(fn, [thisp])`
|
||||
|
||||
Same as `cache.forEach(fn, thisp)`, but in order from least
|
||||
recently used to most recently used.
|
||||
|
||||
### `pop()`
|
||||
|
||||
Evict the least recently used item, returning its value.
|
||||
|
||||
Returns `undefined` if cache is empty.
|
||||
|
||||
## Status Tracking
|
||||
|
||||
Occasionally, it may be useful to track the internal behavior of
|
||||
the cache, particularly for logging, debugging, or for behavior
|
||||
within the `fetchMethod`. To do this, you can pass a `status`
|
||||
object to the `get()`, `set()`, `has()`, and `fetch()` methods.
|
||||
|
||||
The `status` option should be a plain JavaScript object.
|
||||
|
||||
The following fields will be set appropriately:
|
||||
|
||||
```ts
|
||||
interface Status<V> {
|
||||
/**
|
||||
* The status of a set() operation.
|
||||
*
|
||||
* - add: the item was not found in the cache, and was added
|
||||
* - update: the item was in the cache, with the same value provided
|
||||
* - replace: the item was in the cache, and replaced
|
||||
* - miss: the item was not added to the cache for some reason
|
||||
*/
|
||||
set?: 'add' | 'update' | 'replace' | 'miss'
|
||||
|
||||
/**
|
||||
* the ttl stored for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
ttl?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the start time for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
start?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The timestamp used for TTL calculation
|
||||
*/
|
||||
now?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* the remaining ttl for the item, or undefined if ttls are not used.
|
||||
*/
|
||||
remainingTTL?: LRUMilliseconds
|
||||
|
||||
/**
|
||||
* The calculated size for the item, if sizes are used.
|
||||
*/
|
||||
size?: LRUSize
|
||||
|
||||
/**
|
||||
* A flag indicating that the item was not stored, due to exceeding the
|
||||
* {@link maxEntrySize}
|
||||
*/
|
||||
maxEntrySizeExceeded?: true
|
||||
|
||||
/**
|
||||
* The old value, specified in the case of `set:'update'` or
|
||||
* `set:'replace'`
|
||||
*/
|
||||
oldValue?: V
|
||||
|
||||
/**
|
||||
* The results of a {@link has} operation
|
||||
*
|
||||
* - hit: the item was found in the cache
|
||||
* - stale: the item was found in the cache, but is stale
|
||||
* - miss: the item was not found in the cache
|
||||
*/
|
||||
has?: 'hit' | 'stale' | 'miss'
|
||||
|
||||
/**
|
||||
* The status of a {@link fetch} operation.
|
||||
* Note that this can change as the underlying fetch() moves through
|
||||
* various states.
|
||||
*
|
||||
* - inflight: there is another fetch() for this key which is in process
|
||||
* - get: there is no fetchMethod, so {@link get} was called.
|
||||
* - miss: the item is not in cache, and will be fetched.
|
||||
* - hit: the item is in the cache, and was resolved immediately.
|
||||
* - stale: the item is in the cache, but stale.
|
||||
* - refresh: the item is in the cache, and not stale, but
|
||||
* {@link forceRefresh} was specified.
|
||||
*/
|
||||
fetch?: 'get' | 'inflight' | 'miss' | 'hit' | 'stale' | 'refresh'
|
||||
|
||||
/**
|
||||
* The {@link fetchMethod} was called
|
||||
*/
|
||||
fetchDispatched?: true
|
||||
|
||||
/**
|
||||
* The cached value was updated after a successful call to fetchMethod
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The reason for a fetch() rejection. Either the error raised by the
|
||||
* {@link fetchMethod}, or the reason for an AbortSignal.
|
||||
*/
|
||||
fetchError?: Error
|
||||
|
||||
/**
|
||||
* The fetch received an abort signal
|
||||
*/
|
||||
fetchAborted?: true
|
||||
|
||||
/**
|
||||
* The abort signal received was ignored, and the fetch was allowed to
|
||||
* continue.
|
||||
*/
|
||||
fetchAbortIgnored?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise resolved successfully
|
||||
*/
|
||||
fetchResolved?: true
|
||||
|
||||
/**
|
||||
* The results of the fetchMethod promise were stored in the cache
|
||||
*/
|
||||
fetchUpdated?: true
|
||||
|
||||
/**
|
||||
* The fetchMethod promise was rejected
|
||||
*/
|
||||
fetchRejected?: true
|
||||
|
||||
/**
|
||||
* The status of a {@link get} operation.
|
||||
*
|
||||
* - fetching: The item is currently being fetched. If a previous value is
|
||||
* present and allowed, that will be returned.
|
||||
* - stale: The item is in the cache, and is stale.
|
||||
* - hit: the item is in the cache
|
||||
* - miss: the item is not in the cache
|
||||
*/
|
||||
get?: 'stale' | 'hit' | 'miss'
|
||||
|
||||
/**
|
||||
* A fetch or get operation returned a stale value.
|
||||
*/
|
||||
returnedStale?: true
|
||||
}
|
||||
```
|
||||
For full description of the API and all options, please see [the
|
||||
LRUCache typedocs](https://isaacs.github.io/node-lru-cache/)
|
||||
|
||||
## Storage Bounds Safety
|
||||
|
||||
|
@ -1066,7 +186,7 @@ This cache never stores undefined values, as `undefined` is used
|
|||
internally in a few places to indicate that a key is not in the
|
||||
cache.
|
||||
|
||||
You may call `cache.set(key, undefined)`, but this is just an
|
||||
You may call `cache.set(key, undefined)`, but this is just
|
||||
an alias for `cache.delete(key)`. Note that this has the effect
|
||||
that `cache.has(key)` will return _false_ after setting it to
|
||||
undefined.
|
||||
|
@ -1195,10 +315,17 @@ before, it probably will not work in version 7 and above.
|
|||
- Minified export available at `'lru-cache/min'`, for both CJS
|
||||
and MJS builds.
|
||||
|
||||
## Changes in Version 9
|
||||
## Breaking Changes in Version 9
|
||||
|
||||
- Named export only, no default export.
|
||||
- AbortController polyfill returned, albeit with a warning when
|
||||
used.
|
||||
|
||||
## Breaking Changes in Version 10
|
||||
|
||||
- `cache.fetch()` return type is now `Promise<V | undefined>`
|
||||
instead of `Promise<V | void>`. This is an irrelevant change
|
||||
practically speaking, but can require changes for TypeScript
|
||||
users.
|
||||
|
||||
For more info, see the [change log](CHANGELOG.md).
|
||||
|
|
54
components/gantt/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
54
components/gantt/node_modules/path-to-regexp/node_modules/isarray/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,54 @@
|
|||
|
||||
# isarray
|
||||
|
||||
`Array#isArray` for older browsers.
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var isArray = require('isarray');
|
||||
|
||||
console.log(isArray([])); // => true
|
||||
console.log(isArray({})); // => false
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
With [npm](http://npmjs.org) do
|
||||
|
||||
```bash
|
||||
$ npm install isarray
|
||||
```
|
||||
|
||||
Then bundle for the browser with
|
||||
[browserify](https://github.com/substack/browserify).
|
||||
|
||||
With [component](http://component.io) do
|
||||
|
||||
```bash
|
||||
$ component install juliangruber/isarray
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(MIT)
|
||||
|
||||
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
|
||||
|
||||
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.
|
|
@ -13,7 +13,7 @@ and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins is one of
|
|||
|
||||
---
|
||||
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made in <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
<img src="https://cdn.evilmartians.com/badges/logo-no-label.svg" alt="" width="22" height="16" /> Made at <b><a href="https://evilmartians.com/devtools?utm_source=postcss&utm_campaign=devtools-button&utm_medium=github">Evil Martians</a></b>, product consulting for <b>developer tools</b>.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
⚠️ This repository isn't being maintained. It's stable and still used in [jsreport](https://github.com/jsreport/jsreport), but we are too busy to provide adequate maintenance. Don't hesitate to let me know if you plan to maintain a fork so I can share it here..
|
||||
--
|
||||
|
||||
# Node simple OData server
|
||||
#Node simple OData server
|
||||
[![NPM Version](http://img.shields.io/npm/v/simple-odata-server.svg?style=flat-square)](https://npmjs.com/package/simple-odata-server)
|
||||
[![License](http://img.shields.io/npm/l/simple-odata-server.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![build status](https://github.com/pofider/node-simple-odata-server/actions/workflows/main.yml/badge.svg)](https://github.com/pofider/node-simple-odata-server/actions)
|
||||
[![Build Status](https://travis-ci.org/pofider/node-simple-odata-server.png?branch=master)](https://travis-ci.org/pofider/node-simple-odata-server)
|
||||
|
||||
**Super simple implementation of OData server running on Node.js with easy adapters for mongodb and nedb.** Just define an OData model, provide a mongo or nedb database, hook into node.js http server and run.
|
||||
|
||||
|
@ -12,15 +9,14 @@ It supports basic operations you would expect like providing $metadata, filterin
|
|||
|
||||
The implementation is tested with [.net OData client](https://github.com/object/Simple.OData.Client) and it should fulfill basic protocol requirements.
|
||||
|
||||
## Get started
|
||||
##Get started
|
||||
|
||||
This is how you can create an OData server with node.js http module and nedb.
|
||||
```js
|
||||
var http = require('http');
|
||||
var Datastore = require('nedb');
|
||||
var db = new Datastore( { inMemoryOnly: true });
|
||||
var ODataServer = require('simple-odata-server');
|
||||
var Adapter = require('simple-odata-server-nedb');
|
||||
var ODataServer = require("simple-odata-server");
|
||||
|
||||
var model = {
|
||||
namespace: "jsreport",
|
||||
|
@ -39,7 +35,7 @@ var model = {
|
|||
|
||||
var odataServer = ODataServer("http://localhost:1337")
|
||||
.model(model)
|
||||
.adapter(Adapter(function(es, cb) { cb(null, db)}));
|
||||
.onNeDB(function(es, cb) { cb(null, db)});
|
||||
|
||||
|
||||
http.createServer(odataServer.handle.bind(odataServer)).listen(1337);
|
||||
|
@ -53,47 +49,32 @@ GET [http://localhost:1337/users?$orderby=test desc]()<br/>
|
|||
GET [http://localhost:1337/users/$count]()<br/>
|
||||
POST, PATCH, DELETE
|
||||
|
||||
## Adapters
|
||||
There are currently two adapters implemented.
|
||||
|
||||
- [mongodb](https://www.mongodb.com/) - [pofider/node-simple-odata-server-mongodb](https://github.com/pofider/node-simple-odata-server-mongodb)
|
||||
- [nedb](https://github.com/louischatriot/nedb) - [pofider/node-simple-odata-server-nedb](https://github.com/pofider/node-simple-odata-server-nedb)
|
||||
|
||||
The `mongo` adapter can be used as
|
||||
##mongodb
|
||||
It works the same way with nedb and mongo. You just need to provide callback for mongo database instance.
|
||||
```js
|
||||
var Adapter = require('simple-odata-server-mongodb')
|
||||
MongoClient.connect(url, function(err, db) {
|
||||
odataServer.adapter(Adapter(function(cb) {
|
||||
cb(err, db.db('myodatadb'));
|
||||
}));
|
||||
odataServer.onMongo(function(cb) { cb(err, db); });
|
||||
});
|
||||
```
|
||||
|
||||
## express.js
|
||||
##express.js
|
||||
It works well also with the express.js. You even don't need to provide service uri in the `ODataServer` constructor because it is taken from the express.js request.
|
||||
|
||||
```js
|
||||
app.use("/odata", function (req, res) {
|
||||
odataServer.handle(req, res);
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## cors
|
||||
You can quickly set up cors without using express and middlewares using this call
|
||||
|
||||
```js
|
||||
odataServer.cors('*')
|
||||
```
|
||||
|
||||
## Configurations
|
||||
Using existing `adapter` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
##Configurations
|
||||
Using `onNeDB` and `onMongo` is just a simple way for initializing `ODataServer`. You can implement your own data layer or override default behavior using following methods:
|
||||
|
||||
```js
|
||||
odataServer
|
||||
.query(fn(setName, query, req, cb))
|
||||
.update(fn(setName, query, update, req, cb))
|
||||
.insert(fn(setName, doc, req, cb))
|
||||
.remove(fn(setName, query, req, cb))
|
||||
.query(fn(setName, query, cb))
|
||||
.update(fn(setName, query, update, cb))
|
||||
.insert(fn(setName, doc, cb))
|
||||
.remove(fn(setName, query, cb))
|
||||
.beforeQuery(fn(setName, query, req, cb))
|
||||
.beforeUpdate(fn(setName, query, req, update))
|
||||
.beforeInsert(fn(setName, doc, req, cb))
|
||||
|
@ -105,16 +86,16 @@ odataServer
|
|||
|
||||
|
||||
|
||||
## Contributions
|
||||
##Contributions
|
||||
I will maintain this repository for a while because I use it in [jsreport](https://github.com/jsreport/jsreport). You are more than welcome to contribute with pull requests and add other basic operations you require.
|
||||
|
||||
## Limitations
|
||||
##Limitations
|
||||
- document ids must have name **_id**
|
||||
- no entity links
|
||||
- no batch operations
|
||||
- no validations
|
||||
- ... this would be a very long list, so rather check yourself
|
||||
|
||||
## License
|
||||
##License
|
||||
See [license](https://github.com/pofider/node-simple-odata-server/blob/master/LICENSE)
|
||||
|
||||
|
|
113
components/gantt/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
113
components/gantt/node_modules/simple-odata-server/node_modules/lodash/README.md
сгенерированный
поставляемый
Normal file
|
@ -0,0 +1,113 @@
|
|||
# lodash v3.0.1
|
||||
|
||||
The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules.
|
||||
|
||||
Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
|
||||
```bash
|
||||
$ lodash modularize modern exports=node -o ./
|
||||
$ lodash modern -d -o ./index.js
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash
|
||||
```
|
||||
|
||||
In Node.js/io.js:
|
||||
|
||||
```js
|
||||
// load the modern build
|
||||
var _ = require('lodash');
|
||||
// or a method category
|
||||
var array = require('lodash/array');
|
||||
// or a method
|
||||
var chunk = require('lodash/array/chunk');
|
||||
```
|
||||
|
||||
See the [package source](https://github.com/lodash/lodash/tree/3.0.1-npm) for more details.
|
||||
|
||||
**Note:**<br>
|
||||
Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.<br>
|
||||
Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default.
|
||||
|
||||
## Module formats
|
||||
|
||||
lodash is also available in a variety of other builds & module formats.
|
||||
|
||||
* npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds
|
||||
* AMD modules for [modern](https://github.com/lodash/lodash/tree/3.0.1-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.0.1-amd) builds
|
||||
* ES modules for the [modern](https://github.com/lodash/lodash/tree/3.0.1-es) build
|
||||
|
||||
## Further Reading
|
||||
|
||||
* [API Documentation](https://lodash.com/docs)
|
||||
* [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences)
|
||||
* [Changelog](https://github.com/lodash/lodash/wiki/Changelog)
|
||||
* [Release Notes](https://github.com/lodash/lodash/releases)
|
||||
* [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap)
|
||||
* [More Resources](https://github.com/lodash/lodash/wiki/Resources)
|
||||
|
||||
## Features *not* in Underscore
|
||||
|
||||
* ~100% [code coverage](https://coveralls.io/r/lodash)
|
||||
* Follows [semantic versioning](http://semver.org/) for releases
|
||||
* [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining
|
||||
* [_(…)](https://lodash.com/docs#_) supports intuitive chaining
|
||||
* [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order
|
||||
* [_.at](https://lodash.com/docs#at) for cherry-picking collection values
|
||||
* [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch
|
||||
* [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after)
|
||||
* [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods
|
||||
* [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size
|
||||
* [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects
|
||||
* [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects
|
||||
* [_.create](https://lodash.com/docs#create) for easier object inheritance
|
||||
* [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions
|
||||
* [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control
|
||||
* [_.findIndex](https://lodash.com/docs#findIndex) & [_.findKey](https://lodash.com/docs#findKey) for finding indexes & keys
|
||||
* [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#vlowRight) (a.k.a `_.compose`)
|
||||
* [_.forEach](https://lodash.com/docs#forEach) supports exiting early
|
||||
* [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties
|
||||
* [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties
|
||||
* [_.includes](https://lodash.com/docs#includes) accepts a `fromIndex`
|
||||
* [_.isError](https://lodash.com/docs#isError) to check for error objects
|
||||
* [_.isNative](https://lodash.com/docs#isNative) to check for native functions
|
||||
* [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects
|
||||
* [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays
|
||||
* [_.keysIn](https://lodash.com/docs#keysIn) & [_.valuesIn](https://lodash.com/docs#valuesIn) for getting keys & values of all enumerable properties
|
||||
* [_.mapValues](https://lodash.com/docs#mapValues) for [mapping](https://lodash.com/docs#map) values to an object
|
||||
* [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend)
|
||||
* [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior
|
||||
* [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays
|
||||
* [_.random](https://lodash.com/docs#random) supports returning floating-point numbers
|
||||
* [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking
|
||||
* [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values
|
||||
* [_.sortByAll](https://lodash.com/docs#sortBy) for sorting by multiple properties
|
||||
* [_.support](https://lodash.com/docs#support) for flagging environment features
|
||||
* [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components)
|
||||
* [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects
|
||||
* [_.thru](https://lodash.com/docs#thru) to pass values thru method chains
|
||||
* [_.where](https://lodash.com/docs#where) supports deep object comparisons
|
||||
* [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union)
|
||||
* [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), &
|
||||
[more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders
|
||||
* [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), &
|
||||
[more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods
|
||||
* [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), &
|
||||
[more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks
|
||||
* [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), &
|
||||
[more](https://lodash.com/docs "_.drop, _.dropRightWhile, _.take, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest)
|
||||
* [_.findLast](https://lodash.com/docs#findLast), [_.findLastIndex](https://lodash.com/docs#findLastIndex), &
|
||||
[more](https://lodash.com/docs "_.findLastKey, _.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods
|
||||
* [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), &
|
||||
[more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings
|
||||
|
||||
## Support
|
||||
|
||||
Tested in Chrome 39-40, Firefox 34-35, IE 6-11, Opera 25-26, Safari 5-8, io.js 1.0.4, Node.js 0.8.28 & 0.10.35, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5.
|
||||
|
||||
Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
|
186
components/gantt/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
186
components/gantt/node_modules/simple-odata-server/node_modules/xmlbuilder/README.md
сгенерированный
поставляемый
|
@ -1,103 +1,83 @@
|
|||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](https://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
[![NPM Version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
[![NPM Downloads](https://img.shields.io/npm/dm/xmlbuilder.svg?style=flat-square)](https://npmjs.com/package/xmlbuilder)
|
||||
|
||||
[![Travis Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/bf7odb20hj77isry?svg=true)](https://ci.appveyor.com/project/oozcitak/xmlbuilder-js)
|
||||
[![Dev Dependency Status](http://img.shields.io/david/dev/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![Code Coverage](https://img.shields.io/coveralls/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://coveralls.io/github/oozcitak/xmlbuilder-js)
|
||||
|
||||
### Announcing `xmlbuilder2`:
|
||||
|
||||
The new release of `xmlbuilder` is available at [`xmlbuilder2`](https://github.com/oozcitak/xmlbuilder2)! `xmlbuilder2` has been redesigned from the ground up to be fully conforming to the [modern DOM specification](https://dom.spec.whatwg.org). It supports XML namespaces, provides built-in converters for multiple formats, collection functions, and more. Please see [upgrading from xmlbuilder](https://oozcitak.github.io/xmlbuilder2/upgrading-from-xmlbuilder.html) in the wiki.
|
||||
|
||||
New development will be focused towards `xmlbuilder2`; `xmlbuilder` will only receive critical bug fixes.
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder')
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder>
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var obj = {
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
repo: {
|
||||
'@type': 'git', // attributes start with @
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // text node
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var xml = builder.create(obj).end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
|
||||
var xml = root.end({ pretty: true});
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details and [examples](https://github.com/oozcitak/xmlbuilder-js/wiki/Examples) for more complex examples.
|
||||
# xmlbuilder-js
|
||||
|
||||
An XML builder for [node.js](http://nodejs.org/) similar to
|
||||
[java-xmlbuilder](https://github.com/jmurty/java-xmlbuilder).
|
||||
|
||||
[![NPM version](http://img.shields.io/npm/v/xmlbuilder.svg?style=flat-square)](https://npmjs.org/package/xmlbuilder)
|
||||
[![Build Status](http://img.shields.io/travis/oozcitak/xmlbuilder-js.svg?style=flat-square)](http://travis-ci.org/oozcitak/xmlbuilder-js)
|
||||
[![Dependency Status](http://img.shields.io/david/oozcitak/xmlbuilder-js.svg?style=flat-square)](https://david-dm.org/oozcitak/xmlbuilder-js)
|
||||
[![License](http://img.shields.io/npm/l/xmlbuilder.svg?style=flat-square)](http://opensource.org/licenses/MIT)
|
||||
|
||||
### Installation:
|
||||
|
||||
``` sh
|
||||
npm install xmlbuilder
|
||||
```
|
||||
|
||||
### Usage:
|
||||
|
||||
``` js
|
||||
var builder = require('xmlbuilder');
|
||||
var xml = builder.create('root')
|
||||
.ele('xmlbuilder', {'for': 'node-js'})
|
||||
.ele('repo', {'type': 'git'}, 'git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.end({ pretty: true});
|
||||
|
||||
console.log(xml);
|
||||
```
|
||||
|
||||
will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<root>
|
||||
<xmlbuilder for="node-js">
|
||||
<repo type="git">git://github.com/oozcitak/xmlbuilder-js.git</repo>
|
||||
</xmlbuilder>
|
||||
</root>
|
||||
```
|
||||
|
||||
It is also possible to convert objects into nodes:
|
||||
|
||||
``` js
|
||||
builder.create({
|
||||
root: {
|
||||
xmlbuilder: {
|
||||
'@for': 'node-js', // attributes start with @
|
||||
repo: {
|
||||
'@type': 'git',
|
||||
'#text': 'git://github.com/oozcitak/xmlbuilder-js.git' // #text denotes element text
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
If you need to do some processing:
|
||||
|
||||
``` js
|
||||
var root = builder.create('squares');
|
||||
root.com('f(x) = x^2');
|
||||
for(var i = 1; i <= 5; i++)
|
||||
{
|
||||
var item = root.ele('data');
|
||||
item.att('x', i);
|
||||
item.att('y', i * i);
|
||||
}
|
||||
```
|
||||
|
||||
This will result in:
|
||||
|
||||
``` xml
|
||||
<?xml version="1.0"?>
|
||||
<squares>
|
||||
<!-- f(x) = x^2 -->
|
||||
<data x="1" y="1"/>
|
||||
<data x="2" y="4"/>
|
||||
<data x="3" y="9"/>
|
||||
<data x="4" y="16"/>
|
||||
<data x="5" y="25"/>
|
||||
</squares>
|
||||
```
|
||||
|
||||
See the [wiki](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@syncfusion/ej2-react-gantt",
|
||||
"version": "26.1.38",
|
||||
"version": "26.1.39",
|
||||
"description": "Essential JS 2 Gantt Component for React",
|
||||
"author": "Syncfusion Inc.",
|
||||
"license": "SEE LICENSE IN license",
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче