feat: update dependencies, node
This commit is contained in:
492
node_modules/@azure/core-http/node_modules/tough-cookie/README.md
generated
vendored
492
node_modules/@azure/core-http/node_modules/tough-cookie/README.md
generated
vendored
@@ -1,191 +1,204 @@
|
||||
[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js
|
||||
# tough-cookie
|
||||
|
||||
[RFC 6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js
|
||||
|
||||
[](https://nodei.co/npm/tough-cookie/)
|
||||
|
||||
[](https://travis-ci.org/salesforce/tough-cookie)
|
||||
|
||||
# Synopsis
|
||||
## Synopsis
|
||||
|
||||
``` javascript
|
||||
var tough = require('tough-cookie');
|
||||
```javascript
|
||||
var tough = require("tough-cookie");
|
||||
var Cookie = tough.Cookie;
|
||||
var cookie = Cookie.parse(header);
|
||||
cookie.value = 'somethingdifferent';
|
||||
cookie.value = "somethingdifferent";
|
||||
header = cookie.toString();
|
||||
|
||||
var cookiejar = new tough.CookieJar();
|
||||
cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);
|
||||
// ...
|
||||
cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) {
|
||||
res.headers['cookie'] = cookies.join('; ');
|
||||
|
||||
// Asynchronous!
|
||||
var cookie = await cookiejar.setCookie(
|
||||
cookie,
|
||||
"https://currentdomain.example.com/path"
|
||||
);
|
||||
var cookies = await cookiejar.getCookies("https://example.com/otherpath");
|
||||
|
||||
// Or with callbacks!
|
||||
cookiejar.setCookie(
|
||||
cookie,
|
||||
"https://currentdomain.example.com/path",
|
||||
function (err, cookie) {
|
||||
/* ... */
|
||||
}
|
||||
);
|
||||
cookiejar.getCookies("http://example.com/otherpath", function (err, cookies) {
|
||||
/* ... */
|
||||
});
|
||||
```
|
||||
|
||||
# Installation
|
||||
Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.
|
||||
|
||||
It's _so_ easy!
|
||||
## Installation
|
||||
|
||||
`npm install tough-cookie`
|
||||
It's _so_ easy! Install with `npm` or your preferred package manager.
|
||||
|
||||
Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken.
|
||||
```sh
|
||||
npm install tough-cookie
|
||||
```
|
||||
|
||||
## Version Support
|
||||
## Node.js Version Support
|
||||
|
||||
Support for versions of node.js will follow that of the [request](https://www.npmjs.com/package/request) module.
|
||||
We follow the [node.js release schedule](https://github.com/nodejs/Release#release-schedule) and support all versions that are in Active LTS or Maintenance. We will always do a major release when dropping support for older versions of node, and we will do so in consultation with our community.
|
||||
|
||||
# API
|
||||
## API
|
||||
|
||||
## tough
|
||||
### tough
|
||||
|
||||
Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound".
|
||||
The top-level exports from `require('tough-cookie')` can all be used as pure functions and don't need to be bound.
|
||||
|
||||
**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary.
|
||||
#### `parseDate(string)`
|
||||
|
||||
### `parseDate(string)`
|
||||
Parse a cookie date string into a `Date`. Parses according to [RFC 6265 Section 5.1.1](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.1), not `Date.parse()`.
|
||||
|
||||
Parse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`.
|
||||
#### `formatDate(date)`
|
||||
|
||||
### `formatDate(date)`
|
||||
Format a `Date` into an [RFC 822](https://datatracker.ietf.org/doc/html/rfc822#section-5) string (the RFC 6265 recommended format).
|
||||
|
||||
Format a Date into a RFC1123 string (the RFC6265-recommended format).
|
||||
#### `canonicalDomain(str)`
|
||||
|
||||
### `canonicalDomain(str)`
|
||||
Transforms a domain name into a canonical domain name. The canonical domain name is a domain name that has been trimmed, lowercased, stripped of leading dot, and optionally punycode-encoded ([Section 5.1.2 of RFC 6265](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.2)). For the most part, this function is idempotent (calling the function with the output from a previous call returns the same output).
|
||||
|
||||
Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects).
|
||||
#### `domainMatch(str, domStr[, canonicalize=true])`
|
||||
|
||||
### `domainMatch(str,domStr[,canonicalize=true])`
|
||||
Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain name and the `domStr` is the "cookie" domain name. Matches according to [RFC 6265 Section 5.1.3](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3), but it helps to think of it as a "suffix match".
|
||||
|
||||
Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match".
|
||||
The `canonicalize` parameter toggles whether the domain parameters get normalized with `canonicalDomain` or not.
|
||||
|
||||
The `canonicalize` parameter will run the other two parameters through `canonicalDomain` or not.
|
||||
#### `defaultPath(path)`
|
||||
|
||||
### `defaultPath(path)`
|
||||
Given a current request/response path, gives the path appropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by [Section 5.1.4 of the RFC](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4).
|
||||
|
||||
Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC.
|
||||
The `path` parameter MUST be _only_ the pathname part of a URI (excluding the hostname, query, fragment, and so on). This is the `.pathname` property of node's `uri.parse()` output.
|
||||
|
||||
The `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output.
|
||||
#### `pathMatch(reqPath, cookiePath)`
|
||||
|
||||
### `pathMatch(reqPath,cookiePath)`
|
||||
|
||||
Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean.
|
||||
Answers "does the request-path path-match a given cookie-path?" as per [RFC 6265 Section 5.1.4](https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4). Returns a boolean.
|
||||
|
||||
This is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`.
|
||||
|
||||
### `parse(cookieString[, options])`
|
||||
#### `parse(cookieString[, options])`
|
||||
|
||||
alias for `Cookie.parse(cookieString[, options])`
|
||||
Alias for [`Cookie.parse(cookieString[, options])`](#cookieparsecookiestring-options).
|
||||
|
||||
### `fromJSON(string)`
|
||||
#### `fromJSON(string)`
|
||||
|
||||
alias for `Cookie.fromJSON(string)`
|
||||
Alias for [`Cookie.fromJSON(string)`](#cookiefromjsonstrorobj).
|
||||
|
||||
### `getPublicSuffix(hostname)`
|
||||
#### `getPublicSuffix(hostname)`
|
||||
|
||||
Returns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.
|
||||
Returns the public suffix of this hostname. The public suffix is the shortest domain name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it.
|
||||
|
||||
For example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`.
|
||||
|
||||
For further information, see http://publicsuffix.org/. This module derives its list from that site. This call is currently a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [get() method](https://www.npmjs.com/package/psl#pslgetdomain).
|
||||
For further information, see the [Public Suffix List](http://publicsuffix.org/). This module derives its list from that site. This call is a wrapper around [`psl`](https://www.npmjs.com/package/psl)'s [`get` method](https://www.npmjs.com/package/psl##pslgetdomain).
|
||||
|
||||
### `cookieCompare(a,b)`
|
||||
#### `cookieCompare(a, b)`
|
||||
|
||||
For use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence:
|
||||
For use with `.sort()`, sorts a list of cookies into the recommended order given in step 2 of ([RFC 6265 Section 5.4](https://datatracker.ietf.org/doc/html/rfc6265#section-5.4)). The sort algorithm is, in order of precedence:
|
||||
|
||||
* Longest `.path`
|
||||
* oldest `.creation` (which has a 1ms precision, same as `Date`)
|
||||
* lowest `.creationIndex` (to get beyond the 1ms precision)
|
||||
- Longest `.path`
|
||||
- oldest `.creation` (which has a 1-ms precision, same as `Date`)
|
||||
- lowest `.creationIndex` (to get beyond the 1-ms precision)
|
||||
|
||||
``` javascript
|
||||
var cookies = [ /* unsorted array of Cookie objects */ ];
|
||||
```javascript
|
||||
var cookies = [
|
||||
/* unsorted array of Cookie objects */
|
||||
];
|
||||
cookies = cookies.sort(cookieCompare);
|
||||
```
|
||||
|
||||
**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.
|
||||
> **Note**: Since the JavaScript `Date` is limited to a 1-ms precision, cookies within the same millisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`, which preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore` since `Set-Cookie` headers are parsed in order, but is not so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ so that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`.
|
||||
|
||||
### `permuteDomain(domain)`
|
||||
#### `permuteDomain(domain)`
|
||||
|
||||
Generates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores.
|
||||
Generates a list of all possible domains that `domainMatch()` the parameter. Can be handy for implementing cookie stores.
|
||||
|
||||
### `permutePath(path)`
|
||||
#### `permutePath(path)`
|
||||
|
||||
Generates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores.
|
||||
Generates a list of all possible paths that `pathMatch()` the parameter. Can be handy for implementing cookie stores.
|
||||
|
||||
|
||||
## Cookie
|
||||
### Cookie
|
||||
|
||||
Exported via `tough.Cookie`.
|
||||
|
||||
### `Cookie.parse(cookieString[, options])`
|
||||
#### `Cookie.parse(cookieString[, options])`
|
||||
|
||||
Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.
|
||||
Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed.
|
||||
|
||||
The options parameter is not required and currently has only one property:
|
||||
|
||||
* _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant.
|
||||
- _loose_ - boolean - if `true` enable parsing of keyless cookies like `=abc` and `=`, which are not RFC-compliant.
|
||||
|
||||
If options is not an object, it is ignored, which means you can use `Array#map` with it.
|
||||
If options is not an object it is ignored, which means it can be used with [`Array#map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).
|
||||
|
||||
Here's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response:
|
||||
To process the Set-Cookie header(s) on a node HTTP/HTTPS response:
|
||||
|
||||
``` javascript
|
||||
if (res.headers['set-cookie'] instanceof Array)
|
||||
cookies = res.headers['set-cookie'].map(Cookie.parse);
|
||||
else
|
||||
cookies = [Cookie.parse(res.headers['set-cookie'])];
|
||||
```javascript
|
||||
if (Array.isArray(res.headers["set-cookie"]))
|
||||
cookies = res.headers["set-cookie"].map(Cookie.parse);
|
||||
else cookies = [Cookie.parse(res.headers["set-cookie"])];
|
||||
```
|
||||
|
||||
_Note:_ in version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation has since been removed.
|
||||
See [Issue 92](https://github.com/salesforce/tough-cookie/issues/92)
|
||||
_Note:_ In version 2.3.3, tough-cookie limited the number of spaces before the `=` to 256 characters. This limitation was removed in version 2.3.4.
|
||||
For more details, see [issue #92](https://github.com/salesforce/tough-cookie/issues/92).
|
||||
|
||||
### Properties
|
||||
#### Properties
|
||||
|
||||
Cookie object properties:
|
||||
|
||||
* _key_ - string - the name or key of the cookie (default "")
|
||||
* _value_ - string - the value of the cookie (default "")
|
||||
* _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()`
|
||||
* _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`
|
||||
* _domain_ - string - the `Domain=` attribute of the cookie
|
||||
* _path_ - string - the `Path=` of the cookie
|
||||
* _secure_ - boolean - the `Secure` cookie flag
|
||||
* _httpOnly_ - boolean - the `HttpOnly` cookie flag
|
||||
* _sameSite_ - string - the `SameSite` cookie attribute (from [RFC6265bis]); must be one of `none`, `lax`, or `strict`
|
||||
* _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)
|
||||
* _creation_ - `Date` - when this cookie was constructed
|
||||
* _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation)
|
||||
- _key_ - string - the name or key of the cookie (default `""`)
|
||||
- _value_ - string - the value of the cookie (default `""`)
|
||||
- _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()`
|
||||
- _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. Can also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()`
|
||||
- _domain_ - string - the `Domain=` attribute of the cookie
|
||||
- _path_ - string - the `Path=` of the cookie
|
||||
- _secure_ - boolean - the `Secure` cookie flag
|
||||
- _httpOnly_ - boolean - the `HttpOnly` cookie flag
|
||||
- _sameSite_ - string - the `SameSite` cookie attribute (from [RFC 6265bis](#rfc-6265bis)); must be one of `none`, `lax`, or `strict`
|
||||
- _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside)
|
||||
- _creation_ - `Date` - when this cookie was constructed
|
||||
- _creationIndex_ - number - set at construction, used to provide greater sort precision (see `cookieCompare(a,b)` for a full explanation)
|
||||
|
||||
After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes:
|
||||
After a cookie has been passed through `CookieJar.setCookie()` it has the following additional attributes:
|
||||
|
||||
* _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied)
|
||||
* _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.
|
||||
* _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar
|
||||
* _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute.
|
||||
- _hostOnly_ - boolean - is this a host-only cookie (that is, no Domain field was set, but was instead implied).
|
||||
- _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one.
|
||||
- _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar.
|
||||
- _lastAccessed_ - `Date` - last time the cookie got accessed. Affects cookie cleaning after it is implemented. Using `cookiejar.getCookies(...)` updates this attribute.
|
||||
|
||||
### `Cookie([{properties}])`
|
||||
#### `new Cookie([properties])`
|
||||
|
||||
Receives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties.
|
||||
Receives an options object that can contain any of the above Cookie properties. Uses the default for unspecified properties.
|
||||
|
||||
### `.toString()`
|
||||
#### `.toString()`
|
||||
|
||||
encode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.
|
||||
Encodes to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`.
|
||||
|
||||
### `.cookieString()`
|
||||
#### `.cookieString()`
|
||||
|
||||
encode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '=').
|
||||
Encodes to a Cookie header value (specifically, the `.key` and `.value` properties joined with `"="`).
|
||||
|
||||
### `.setExpires(String)`
|
||||
#### `.setExpires(string)`
|
||||
|
||||
sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `"Infinity"` (a string) is set.
|
||||
Sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (that is, can't parse this date string), `.expires` is set to `"Infinity"` (a string).
|
||||
|
||||
### `.setMaxAge(number)`
|
||||
#### `.setMaxAge(number)`
|
||||
|
||||
sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it JSON serializes correctly.
|
||||
Sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it correctly serializes to JSON.
|
||||
|
||||
### `.expiryTime([now=Date.now()])`
|
||||
#### `.expiryDate([now=Date.now()])`
|
||||
|
||||
### `.expiryDate([now=Date.now()])`
|
||||
|
||||
expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.
|
||||
`expiryTime()` computes the absolute unix-epoch milliseconds that this cookie expires. `expiryDate()` works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds.
|
||||
|
||||
Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` parameter -- is used to offset the `.maxAge` attribute.
|
||||
|
||||
@@ -193,45 +206,45 @@ If Expires (`.expires`) is set, that's returned.
|
||||
|
||||
Otherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for "Tue, 19 Jan 2038 03:14:07 GMT" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents).
|
||||
|
||||
### `.TTL([now=Date.now()])`
|
||||
#### `.TTL([now=Date.now()])`
|
||||
|
||||
compute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.
|
||||
Computes the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply.
|
||||
|
||||
The "number" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.
|
||||
`Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned.
|
||||
|
||||
### `.canonicalizedDomain()`
|
||||
#### `.canonicalizedDomain()`
|
||||
|
||||
### `.cdomain()`
|
||||
#### `.cdomain()`
|
||||
|
||||
return the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters.
|
||||
Returns the canonicalized `.domain` field. This is lower-cased and punycode ([RFC 3490](https://datatracker.ietf.org/doc/html/rfc3490)) encoded if the domain has any non-ASCII characters.
|
||||
|
||||
### `.toJSON()`
|
||||
#### `.toJSON()`
|
||||
|
||||
For convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized.
|
||||
|
||||
Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).
|
||||
Any `Date` properties (such as `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`).
|
||||
|
||||
**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
|
||||
> **NOTE**: Custom `Cookie` properties are discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
|
||||
|
||||
### `Cookie.fromJSON(strOrObj)`
|
||||
#### `Cookie.fromJSON(strOrObj)`
|
||||
|
||||
Does the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first.
|
||||
|
||||
Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer.
|
||||
Any `Date` properties (such as `.expires`, `.creation`, and `.lastAccessed`) are parsed via [`Date.parse`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse), not tough-cookie's `parseDate`, since ISO timestamps are being handled at this layer.
|
||||
|
||||
Returns `null` upon JSON parsing error.
|
||||
Returns `null` upon a JSON parsing error.
|
||||
|
||||
### `.clone()`
|
||||
#### `.clone()`
|
||||
|
||||
Does a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`.
|
||||
Does a deep clone of this cookie, implemented exactly as `Cookie.fromJSON(cookie.toJSON())`.
|
||||
|
||||
### `.validate()`
|
||||
#### `.validate()`
|
||||
|
||||
Status: *IN PROGRESS*. Works for a few things, but is by no means comprehensive.
|
||||
Status: _IN PROGRESS_. Works for a few things, but is by no means comprehensive.
|
||||
|
||||
validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct:
|
||||
Validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string. Future-proof with this construct:
|
||||
|
||||
``` javascript
|
||||
```javascript
|
||||
if (cookie.validate() === true) {
|
||||
// it's tasty
|
||||
} else {
|
||||
@@ -239,225 +252,225 @@ if (cookie.validate() === true) {
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## CookieJar
|
||||
### CookieJar
|
||||
|
||||
Exported via `tough.CookieJar`.
|
||||
|
||||
### `CookieJar([store],[options])`
|
||||
#### `CookieJar([store][, options])`
|
||||
|
||||
Simply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used.
|
||||
Simply use `new CookieJar()`. If a custom store is not passed to the constructor, a [`MemoryCookieStore`](#memorycookiestore) is created and used.
|
||||
|
||||
The `options` object can be omitted and can have the following properties:
|
||||
|
||||
* _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like "com" and "co.uk"
|
||||
* _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.
|
||||
* _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes] below.
|
||||
* _allowSpecialUseDomain_ - boolean - default `false` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.
|
||||
This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers.
|
||||
- _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like "com" and "co.uk"
|
||||
- _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name.
|
||||
- _prefixSecurity_ - string - default `silent` - set to `'unsafe-disabled'`, `'silent'`, or `'strict'`. See [Cookie Prefixes](#cookie-prefixes) below.
|
||||
- _allowSpecialUseDomain_ - boolean - default `true` - accepts special-use domain suffixes, such as `local`. Useful for testing purposes.
|
||||
This is not in the standard, but is used sometimes on the web and is accepted by most browsers.
|
||||
|
||||
Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods.
|
||||
#### `.setCookie(cookieOrString, currentUrl[, options][, callback(err, cookie)])`
|
||||
|
||||
### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))`
|
||||
|
||||
Attempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties.
|
||||
Attempt to set the cookie in the cookie jar. The cookie has updated `.creation`, `.lastAccessed` and `.hostOnly` properties. And returns a promise if a callback is not provided.
|
||||
|
||||
The `options` object can be omitted and can have the following properties:
|
||||
|
||||
* _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
|
||||
* _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
|
||||
* _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
|
||||
* _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.
|
||||
* _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies] below.
|
||||
- _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects `HttpOnly` cookies.
|
||||
- _secure_ - boolean - autodetect from URL - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` this defaults to `true`, otherwise `false`.
|
||||
- _now_ - Date - default `new Date()` - what to use for the creation or access time of cookies.
|
||||
- _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option.
|
||||
- _sameSiteContext_ - string - default unset - set to `'none'`, `'lax'`, or `'strict'` See [SameSite Cookies](#samesite-cookies) below.
|
||||
|
||||
As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).
|
||||
As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual).
|
||||
|
||||
### `.setCookieSync(cookieOrString, currentUrl, [{options}])`
|
||||
#### `.setCookieSync(cookieOrString, currentUrl[, options])`
|
||||
|
||||
Synchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
|
||||
Synchronous version of [`setCookie`](#setcookiecookieorstring-currenturl-options-callbackerr-cookie); only works with synchronous stores (that is, the default `MemoryCookieStore`).
|
||||
|
||||
### `.getCookies(currentUrl, [{options},] cb(err,cookies))`
|
||||
#### `.getCookies(currentUrl[, options][, callback(err, cookies)])`
|
||||
|
||||
Retrieve the list of cookies that can be sent in a Cookie header for the current url.
|
||||
Retrieve the list of cookies that can be sent in a Cookie header for the current URL. Returns a promise if a callback is not provided.
|
||||
|
||||
If an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.
|
||||
Returns an array of `Cookie` objects, sorted by default using [`cookieCompare`](#cookiecomparea-b).
|
||||
|
||||
If an error is encountered it's passed as `err` to the callback, otherwise an array of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given.
|
||||
|
||||
The `options` object can be omitted and can have the following properties:
|
||||
|
||||
* _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies.
|
||||
* _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
|
||||
* _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies
|
||||
* _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially).
|
||||
* _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).
|
||||
* _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'` or `'strict'` to enforce SameSite cookies upon retrival. See [SameSite Cookies] below.
|
||||
- _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects `HttpOnly` cookies.
|
||||
- _secure_ - boolean - autodetect from URL - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`.
|
||||
- _now_ - Date - default `new Date()` - what to use for the creation or access time of cookies
|
||||
- _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` returns expired cookies and does **not** remove them from the store (which is potentially useful for replaying Set-Cookie headers).
|
||||
- _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it).
|
||||
- _sameSiteContext_ - string - default unset - Set this to `'none'`, `'lax'`, or `'strict'` to enforce SameSite cookies upon retrieval. See [SameSite Cookies](#samesite-cookies) below.
|
||||
- _sort_ - boolean - whether to sort the list of cookies.
|
||||
|
||||
The `.lastAccessed` property of the returned cookies will have been updated.
|
||||
|
||||
### `.getCookiesSync(currentUrl, [{options}])`
|
||||
#### `.getCookiesSync(currentUrl, [{options}])`
|
||||
|
||||
Synchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
|
||||
Synchronous version of [`getCookies`](#getcookiescurrenturl-options-callbackerr-cookies); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
### `.getCookieString(...)`
|
||||
#### `.getCookieString(...)`
|
||||
|
||||
Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`.
|
||||
Accepts the same options as [`.getCookies()`](#getcookiescurrenturl-options-callbackerr-cookies) but returns a string suitable for a Cookie header rather than an Array.
|
||||
|
||||
### `.getCookieStringSync(...)`
|
||||
#### `.getCookieStringSync(...)`
|
||||
|
||||
Synchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
|
||||
Synchronous version of [`getCookieString`](#getcookiestring); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
### `.getSetCookieStrings(...)`
|
||||
#### `.getSetCookieStrings(...)`
|
||||
|
||||
Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`.
|
||||
Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as [`.getCookies()`](#getcookiescurrenturl-options-callbackerr-cookies). Simply maps the cookie array via `.toString()`.
|
||||
|
||||
### `.getSetCookieStringsSync(...)`
|
||||
#### `.getSetCookieStringsSync(...)`
|
||||
|
||||
Synchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`).
|
||||
Synchronous version of [`getSetCookieStrings`](#getsetcookiestrings); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
### `.serialize(cb(err,serializedObject))`
|
||||
#### `.serialize([callback(err, serializedObject)])`
|
||||
|
||||
Returns a promise if a callback is not provided.
|
||||
|
||||
Serialize the Jar if the underlying store supports `.getAllCookies`.
|
||||
|
||||
**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
|
||||
> **NOTE**: Custom `Cookie` properties are discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array.
|
||||
|
||||
See [Serialization Format].
|
||||
See [Serialization Format](#serialization-format).
|
||||
|
||||
### `.serializeSync()`
|
||||
#### `.serializeSync()`
|
||||
|
||||
Sync version of .serialize
|
||||
Synchronous version of [`serialize`](#serializecallbackerr-serializedobject); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
### `.toJSON()`
|
||||
#### `.toJSON()`
|
||||
|
||||
Alias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`.
|
||||
Alias of [`.serializeSync()`](#serializesync) for the convenience of `JSON.stringify(cookiejar)`.
|
||||
|
||||
### `CookieJar.deserialize(serialized, [store], cb(err,object))`
|
||||
#### `CookieJar.deserialize(serialized[, store][, callback(err, object)])`
|
||||
|
||||
A new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization.
|
||||
A new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization. A promise is returned if a callback is not provided.
|
||||
|
||||
The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created.
|
||||
|
||||
As a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback.
|
||||
As a convenience, if `serialized` is a string, it is passed through `JSON.parse` first.
|
||||
|
||||
### `CookieJar.deserializeSync(serialized, [store])`
|
||||
#### `CookieJar.deserializeSync(serialized[, store])`
|
||||
|
||||
Sync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work.
|
||||
Sync version of [`.deserialize`](#cookiejardeserializeserialized-store-callbackerr-object); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
### `CookieJar.fromJSON(string)`
|
||||
#### `CookieJar.fromJSON(string)`
|
||||
|
||||
Alias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`.
|
||||
Alias of [`.deserializeSync`](#cookiejardeserializesyncserialized-store) to provide consistency with [`Cookie.fromJSON()`](#cookiefromjsonstrorobj).
|
||||
|
||||
### `.clone([store,]cb(err,newJar))`
|
||||
#### `.clone([store][, callback(err, cloned))`
|
||||
|
||||
Produces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa.
|
||||
Produces a deep clone of this jar. Modifications to the original do not affect the clone, and vice versa. Returns a promise if a callback is not provided.
|
||||
|
||||
The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`.
|
||||
|
||||
### `.cloneSync([store])`
|
||||
#### `.cloneSync([store])`
|
||||
|
||||
Synchronous version of `.clone`, returning a new `CookieJar` instance.
|
||||
Synchronous version of [`.clone`](#clonestore-callbackerr-cloned), returning a new `CookieJar` instance.
|
||||
|
||||
The `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used.
|
||||
|
||||
The _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls.
|
||||
|
||||
### `.removeAllCookies(cb(err))`
|
||||
#### `.removeAllCookies([callback(err)])`
|
||||
|
||||
Removes all cookies from the jar.
|
||||
Removes all cookies from the jar. Returns a promise if a callback is not provided.
|
||||
|
||||
This is a new backwards-compatible feature of `tough-cookie` version 2.5, so not all Stores will implement it efficiently. For Stores that do not implement `removeAllCookies`, the fallback is to call `removeCookie` after `getAllCookies`. If `getAllCookies` fails or isn't implemented in the Store, that error is returned. If one or more of the `removeCookie` calls fail, only the first error is returned.
|
||||
|
||||
### `.removeAllCookiesSync()`
|
||||
#### `.removeAllCookiesSync()`
|
||||
|
||||
Sync version of `.removeAllCookies()`
|
||||
Sync version of [`.removeAllCookies()`](#removeallcookiescallbackerr); only works with synchronous stores (for example, the default `MemoryCookieStore`).
|
||||
|
||||
## Store
|
||||
### Store
|
||||
|
||||
Base class for CookieJar stores. Available as `tough.Store`.
|
||||
|
||||
## Store API
|
||||
### Store API
|
||||
|
||||
The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores.
|
||||
The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in [`lib/memstore.js`](https://github.com/salesforce/tough-cookie/blob/master/lib/memstore.js). The API uses continuation-passing-style to allow for asynchronous stores.
|
||||
|
||||
Stores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`.
|
||||
Stores should inherit from the base `Store` class, which is available as a top-level export.
|
||||
|
||||
Stores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style
|
||||
Stores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods of the containing `CookieJar` can be used.
|
||||
|
||||
All `domain` parameters will have been normalized before calling.
|
||||
All `domain` parameters are normalized before calling.
|
||||
|
||||
The Cookie store must have all of the following methods.
|
||||
The Cookie store must have all of the following methods. Note that asynchronous implementations **must** support callback parameters.
|
||||
|
||||
### `store.findCookie(domain, path, key, cb(err,cookie))`
|
||||
#### `store.findCookie(domain, path, key, callback(err, cookie))`
|
||||
|
||||
Retrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned.
|
||||
Retrieve a cookie with the given domain, path, and key (name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest or newest such cookie should be returned.
|
||||
|
||||
Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error).
|
||||
Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (that is, not an error).
|
||||
|
||||
### `store.findCookies(domain, path, cb(err,cookies))`
|
||||
#### `store.findCookies(domain, path, callback(err, cookies))`
|
||||
|
||||
Locates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above.
|
||||
Locates cookies matching the given domain and path. This is most often called in the context of [`cookiejar.getCookies()`](#getcookiescurrenturl-options-callbackerr-cookies).
|
||||
|
||||
If no cookies are found, the callback MUST be passed an empty array.
|
||||
|
||||
The resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.
|
||||
The resulting list is checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, and so on), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done.
|
||||
|
||||
As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only).
|
||||
As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above causes the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (that is, domain-matching only).
|
||||
|
||||
### `store.putCookie(cookie, cb(err))`
|
||||
#### `store.putCookie(cookie, callback(err))`
|
||||
|
||||
Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.
|
||||
Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties. Depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur.
|
||||
|
||||
The `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties.
|
||||
The `cookie` object MUST NOT be modified; as the caller has already updated the `.creation` and `.lastAccessed` properties.
|
||||
|
||||
Pass an error if the cookie cannot be stored.
|
||||
|
||||
### `store.updateCookie(oldCookie, newCookie, cb(err))`
|
||||
#### `store.updateCookie(oldCookie, newCookie, callback(err))`
|
||||
|
||||
Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.
|
||||
Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path`, and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store.
|
||||
|
||||
The `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement).
|
||||
The `.lastAccessed` property is always different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (for example, least-recently-used, which is up to the store to implement).
|
||||
|
||||
Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object.
|
||||
Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method, a stub that calls [`putCookie`](#storeputcookiecookie-callbackerr) is added to the store object.
|
||||
|
||||
The `newCookie` and `oldCookie` objects MUST NOT be modified.
|
||||
|
||||
Pass an error if the newCookie cannot be stored.
|
||||
|
||||
### `store.removeCookie(domain, path, key, cb(err))`
|
||||
#### `store.removeCookie(domain, path, key, callback(err))`
|
||||
|
||||
Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint).
|
||||
Remove a cookie from the store (see notes on [`findCookie`](#storefindcookiedomain-path-key-callbackerr-cookie) about the uniqueness constraint).
|
||||
|
||||
The implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie.
|
||||
The implementation MUST NOT pass an error if the cookie doesn't exist, and only pass an error due to the failure to remove an existing cookie.
|
||||
|
||||
### `store.removeCookies(domain, path, cb(err))`
|
||||
#### `store.removeCookies(domain, path, callback(err))`
|
||||
|
||||
Removes matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed.
|
||||
Removes matching cookies from the store. The `path` parameter is optional and if missing, means all paths in a domain should be removed.
|
||||
|
||||
Pass an error ONLY if removing any existing cookies failed.
|
||||
|
||||
### `store.removeAllCookies(cb(err))`
|
||||
#### `store.removeAllCookies(callback(err))`
|
||||
|
||||
_Optional_. Removes all cookies from the store.
|
||||
|
||||
Pass an error if one or more cookies can't be removed.
|
||||
|
||||
**Note**: New method as of `tough-cookie` version 2.5, so not all Stores will implement this, plus some stores may choose not to implement this.
|
||||
#### `store.getAllCookies(callback(err, cookies))`
|
||||
|
||||
### `store.getAllCookies(cb(err, cookies))`
|
||||
_Optional_. Produces an `Array` of all cookies during [`jar.serialize()`](#serializecallbackerr-serializedobject). The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format](#serialization-format) data structure.
|
||||
|
||||
_Optional_. Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure.
|
||||
|
||||
Cookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail.
|
||||
Cookies SHOULD be returned in creation order to preserve sorting via [`compareCookie()`](#cookiecomparea-b). For reference, `MemoryCookieStore` sorts by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1-ms. See `cookieCompare` for more detail.
|
||||
|
||||
Pass an error if retrieval fails.
|
||||
|
||||
**Note**: not all Stores can implement this due to technical limitations, so it is optional.
|
||||
**Note**: Not all Stores can implement this due to technical limitations, so it is optional.
|
||||
|
||||
## MemoryCookieStore
|
||||
### MemoryCookieStore
|
||||
|
||||
Inherits from `Store`.
|
||||
|
||||
A just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. Supports serialization, `getAllCookies`, and `removeAllCookies`.
|
||||
|
||||
## Community Cookie Stores
|
||||
### Community Cookie Stores
|
||||
|
||||
These are some Store implementations authored and maintained by the community. They aren't official and we don't vouch for them but you may be interested to have a look:
|
||||
|
||||
@@ -467,10 +480,9 @@ These are some Store implementations authored and maintained by the community. T
|
||||
- [`tough-cookie-filestore`](https://github.com/mitsuru/tough-cookie-filestore): JSON on disk
|
||||
- [`tough-cookie-web-storage-store`](https://github.com/exponentjs/tough-cookie-web-storage-store): DOM localStorage and sessionStorage
|
||||
|
||||
## Serialization Format
|
||||
|
||||
# Serialization Format
|
||||
|
||||
**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.
|
||||
**NOTE**: If you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`.
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -496,57 +508,59 @@ These are some Store implementations authored and maintained by the community. T
|
||||
}
|
||||
```
|
||||
|
||||
# RFC6265bis
|
||||
## RFC 6265bis
|
||||
|
||||
Support for RFC6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC6252, support is broken up into the functional areas.
|
||||
Support for RFC 6265bis revision 02 is being developed. Since this is a bit of an omnibus revision to the RFC 6252, support is broken up into the functional areas.
|
||||
|
||||
## Leave Secure Cookies Alone
|
||||
### Leave Secure Cookies Alone
|
||||
|
||||
Not yet supported.
|
||||
|
||||
This change makes it so that if a cookie is sent from the server to the client with a `Secure` attribute, the channel must also be secure or the cookie is ignored.
|
||||
|
||||
## SameSite Cookies
|
||||
### SameSite Cookies
|
||||
|
||||
Supported.
|
||||
|
||||
This change makes it possible for servers, and supporting clients, to mitigate certain types of CSRF attacks by disallowing `SameSite` cookies from being sent cross-origin.
|
||||
|
||||
On the Cookie object itself, you can get/set the `.sameSite` attribute, which will be serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute will be serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values will be serialized as-is.
|
||||
On the Cookie object itself, you can get or set the `.sameSite` attribute, which is serialized into the `SameSite=` cookie attribute. When unset or `undefined`, no `SameSite=` attribute is serialized. The valid values of this attribute are `'none'`, `'lax'`, or `'strict'`. Other values are serialized as-is.
|
||||
|
||||
When parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` will parse so that `cookie.sameSite === 'none'`.
|
||||
When parsing cookies with a `SameSite` cookie attribute, values other than `'lax'` or `'strict'` are parsed as `'none'`. For example, `SomeCookie=SomeValue; SameSite=garbage` parses so that `cookie.sameSite === 'none'`.
|
||||
|
||||
In order to support SameSite cookies, you must provide a `sameSiteContext` option to _both_ `setCookie` and `getCookies`. Valid values for this option are just like for the Cookie object, but have particular meanings:
|
||||
1. `'strict'` mode - If the request is on the same "site for cookies" (see the RFC draft for what this means), pass this option to add a layer of defense against CSRF.
|
||||
2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, e.g., `<link type=prefetch>` or `<a href="...">`, pass `sameSiteContext: 'lax'`.
|
||||
|
||||
1. `'strict'` mode - If the request is on the same "site for cookies" (see the RFC draft for more information), pass this option to add a layer of defense against CSRF.
|
||||
2. `'lax'` mode - If the request is from another site, _but_ is directly because of navigation by the user, such as, `<link type=prefetch>` or `<a href="...">`, pass `sameSiteContext: 'lax'`.
|
||||
3. `'none'` - Otherwise, pass `sameSiteContext: 'none'` (this indicates a cross-origin request).
|
||||
4. unset/`undefined` - SameSite **will not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.
|
||||
4. unset/`undefined` - SameSite **is not** be enforced! This can be a valid use-case for when CSRF isn't in the threat model of the system being built.
|
||||
|
||||
It is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02#section-8.8) discusses security considerations and defense in depth.
|
||||
It is highly recommended that you read RFC 6265bis for fine details on SameSite cookies. In particular [Section 8.8](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-02##section-8.8) discusses security considerations and defense in depth.
|
||||
|
||||
## Cookie Prefixes
|
||||
### Cookie Prefixes
|
||||
|
||||
Supported.
|
||||
|
||||
Cookie prefixes are a way to indicate that a given cookie was set with a set of attributes simply by inspecting the first few characters of the cookie's name.
|
||||
|
||||
Cookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.3). Two prefixes are defined:
|
||||
Cookie prefixes are defined in [Section 4.1.3 of 6265bis](https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03##section-4.1.3).
|
||||
|
||||
1. `"__Secure-" Prefix`: If a cookie's name begins with a case-sensitive match for the string "__Secure-", then the cookie will have been set with a "Secure" attribute.
|
||||
2. `"__Host-" Prefix`: If a cookie's name begins with a case-sensitive match for the string "__Host-", then the cookie will have been set with a "Secure" attribute, a "Path" attribute with a value of "/", and no "Domain" attribute.
|
||||
Two prefixes are defined:
|
||||
|
||||
If `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions will not be added.
|
||||
1. `"__Secure-" Prefix`: If a cookie's name begins with a case-sensitive match for the string "\_\_Secure-", then the cookie was set with a "Secure" attribute.
|
||||
2. `"__Host-" Prefix`: If a cookie's name begins with a case-sensitive match for the string "\_\_Host-", then the cookie was set with a "Secure" attribute, a "Path" attribute with a value of "/", and no "Domain" attribute.
|
||||
|
||||
You can define this functionality by passing in `prefixSecurity` option to `CookieJar`. It can be one of 3 values:
|
||||
If `prefixSecurity` is enabled for `CookieJar`, then cookies that match the prefixes defined above but do not obey the attribute restrictions are not added.
|
||||
|
||||
1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions not met. Default.
|
||||
2. `strict`: Enable cookie prefix checking and error out if conditions not met.
|
||||
You can define this functionality by passing in the `prefixSecurity` option to `CookieJar`. It can be one of 3 values:
|
||||
|
||||
1. `silent`: Enable cookie prefix checking but silently fail to add the cookie if conditions are not met. Default.
|
||||
2. `strict`: Enable cookie prefix checking and error out if conditions are not met.
|
||||
3. `unsafe-disabled`: Disable cookie prefix checking.
|
||||
|
||||
Note that if `ignoreError` is passed in as `true` then the error will be silent regardless of `prefixSecurity` option (assuming it's enabled).
|
||||
Note that if `ignoreError` is passed in as `true` then the error is silent regardless of the `prefixSecurity` option (assuming it's enabled).
|
||||
|
||||
|
||||
# Copyright and License
|
||||
## Copyright and License
|
||||
|
||||
BSD-3-Clause:
|
||||
|
||||
|
||||
133
node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookie.js
generated
vendored
133
node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookie.js
generated
vendored
@@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* Copyright (c) 2015, Salesforce.com, Inc.
|
||||
* Copyright (c) 2015-2020, Salesforce.com, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,15 +29,16 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
"use strict";
|
||||
const punycode = require("punycode");
|
||||
const urlParse = require("url").parse;
|
||||
const util = require("util");
|
||||
const punycode = require("punycode/");
|
||||
const urlParse = require("url-parse");
|
||||
const pubsuffix = require("./pubsuffix-psl");
|
||||
const Store = require("./store").Store;
|
||||
const MemoryCookieStore = require("./memstore").MemoryCookieStore;
|
||||
const pathMatch = require("./pathMatch").pathMatch;
|
||||
const validators = require("./validators.js");
|
||||
const VERSION = require("./version");
|
||||
const { fromCallback } = require("universalify");
|
||||
const { getCustomInspectSymbol } = require("./utilHelper");
|
||||
|
||||
// From RFC6265 S4.1.1
|
||||
// note that it excludes \x3B ";"
|
||||
@@ -79,6 +80,7 @@ const SAME_SITE_CONTEXT_VAL_ERR =
|
||||
'Invalid sameSiteContext option for getCookies(); expected one of "strict", "lax", or "none"';
|
||||
|
||||
function checkSameSiteContext(value) {
|
||||
validators.validate(validators.isNonEmptyString(value), value);
|
||||
const context = String(value).toLowerCase();
|
||||
if (context === "none" || context === "lax" || context === "strict") {
|
||||
return context;
|
||||
@@ -97,7 +99,23 @@ const PrefixSecurityEnum = Object.freeze({
|
||||
// * all capturing groups converted to non-capturing -- "(?:)"
|
||||
// * support for IPv6 Scoped Literal ("%eth1") removed
|
||||
// * lowercase hexadecimal only
|
||||
var IP_REGEX_LOWERCASE =/(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/;
|
||||
const IP_REGEX_LOWERCASE = /(?:^(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}$)|(?:^(?:(?:[a-f\d]{1,4}:){7}(?:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|:[a-f\d]{1,4}|:)|(?:[a-f\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,2}|:)|(?:[a-f\d]{1,4}:){4}(?:(?::[a-f\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,3}|:)|(?:[a-f\d]{1,4}:){3}(?:(?::[a-f\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,4}|:)|(?:[a-f\d]{1,4}:){2}(?:(?::[a-f\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,5}|:)|(?:[a-f\d]{1,4}:){1}(?:(?::[a-f\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,6}|:)|(?::(?:(?::[a-f\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)){3}|(?::[a-f\d]{1,4}){1,7}|:)))$)/;
|
||||
const IP_V6_REGEX = `
|
||||
\\[?(?:
|
||||
(?:[a-fA-F\\d]{1,4}:){7}(?:[a-fA-F\\d]{1,4}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|:[a-fA-F\\d]{1,4}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){5}(?::(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,2}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){4}(?:(?::[a-fA-F\\d]{1,4}){0,1}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,3}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){3}(?:(?::[a-fA-F\\d]{1,4}){0,2}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,4}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){2}(?:(?::[a-fA-F\\d]{1,4}){0,3}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,5}|:)|
|
||||
(?:[a-fA-F\\d]{1,4}:){1}(?:(?::[a-fA-F\\d]{1,4}){0,4}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,6}|:)|
|
||||
(?::(?:(?::[a-fA-F\\d]{1,4}){0,5}:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}|(?::[a-fA-F\\d]{1,4}){1,7}|:))
|
||||
)(?:%[0-9a-zA-Z]{1,})?\\]?
|
||||
`
|
||||
.replace(/\s*\/\/.*$/gm, "")
|
||||
.replace(/\n/g, "")
|
||||
.trim();
|
||||
const IP_V6_REGEX_OBJECT = new RegExp(`^${IP_V6_REGEX}$`);
|
||||
|
||||
/*
|
||||
* Parses a Natural number (i.e., non-negative integer) with either the
|
||||
@@ -301,6 +319,7 @@ function parseDate(str) {
|
||||
}
|
||||
|
||||
function formatDate(date) {
|
||||
validators.validate(validators.isDate(date), date);
|
||||
return date.toUTCString();
|
||||
}
|
||||
|
||||
@@ -311,6 +330,10 @@ function canonicalDomain(str) {
|
||||
}
|
||||
str = str.trim().replace(/^\./, ""); // S4.1.2.3 & S5.2.3: ignore leading .
|
||||
|
||||
if (IP_V6_REGEX_OBJECT.test(str)) {
|
||||
str = str.replace("[", "").replace("]", "");
|
||||
}
|
||||
|
||||
// convert to IDN if any non-ASCII characters
|
||||
if (punycode && /[^\u0001-\u007f]/.test(str)) {
|
||||
str = punycode.toASCII(str);
|
||||
@@ -345,7 +368,7 @@ function domainMatch(str, domStr, canonicalize) {
|
||||
/* " o All of the following [three] conditions hold:" */
|
||||
|
||||
/* "* The domain string is a suffix of the string" */
|
||||
const idx = str.indexOf(domStr);
|
||||
const idx = str.lastIndexOf(domStr);
|
||||
if (idx <= 0) {
|
||||
return false; // it's a non-match (-1) or prefix (0)
|
||||
}
|
||||
@@ -359,7 +382,7 @@ function domainMatch(str, domStr, canonicalize) {
|
||||
|
||||
/* " * The last character of the string that is not included in the
|
||||
* domain string is a %x2E (".") character." */
|
||||
if (str.substr(idx-1,1) !== '.') {
|
||||
if (str.substr(idx - 1, 1) !== ".") {
|
||||
return false; // doesn't align on "."
|
||||
}
|
||||
|
||||
@@ -403,6 +426,7 @@ function defaultPath(path) {
|
||||
}
|
||||
|
||||
function trimTerminator(str) {
|
||||
if (validators.isEmptyString(str)) return str;
|
||||
for (let t = 0; t < TERMINATORS.length; t++) {
|
||||
const terminatorIdx = str.indexOf(TERMINATORS[t]);
|
||||
if (terminatorIdx !== -1) {
|
||||
@@ -415,6 +439,7 @@ function trimTerminator(str) {
|
||||
|
||||
function parseCookiePair(cookiePair, looseMode) {
|
||||
cookiePair = trimTerminator(cookiePair);
|
||||
validators.validate(validators.isString(cookiePair), cookiePair);
|
||||
|
||||
let firstEq = cookiePair.indexOf("=");
|
||||
if (looseMode) {
|
||||
@@ -454,6 +479,11 @@ function parse(str, options) {
|
||||
if (!options || typeof options !== "object") {
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (validators.isEmptyString(str) || !validators.isString(str)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
str = str.trim();
|
||||
|
||||
// We use a regex to parse the "name-value-pair" part of S5.2
|
||||
@@ -589,11 +619,11 @@ function parse(str, options) {
|
||||
case "lax":
|
||||
c.sameSite = "lax";
|
||||
break;
|
||||
case "none":
|
||||
c.sameSite = "none";
|
||||
break;
|
||||
default:
|
||||
// RFC6265bis-02 S5.3.7 step 1:
|
||||
// "If cookie-av's attribute-value is not a case-insensitive match
|
||||
// for "Strict" or "Lax", ignore the "cookie-av"."
|
||||
// This effectively sets it to 'none' from the prototype.
|
||||
c.sameSite = undefined;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -616,6 +646,7 @@ function parse(str, options) {
|
||||
* @returns boolean
|
||||
*/
|
||||
function isSecurePrefixConditionMet(cookie) {
|
||||
validators.validate(validators.isObject(cookie), cookie);
|
||||
return !cookie.key.startsWith("__Secure-") || cookie.secure;
|
||||
}
|
||||
|
||||
@@ -631,6 +662,7 @@ function isSecurePrefixConditionMet(cookie) {
|
||||
* @returns boolean
|
||||
*/
|
||||
function isHostPrefixConditionMet(cookie) {
|
||||
validators.validate(validators.isObject(cookie));
|
||||
return (
|
||||
!cookie.key.startsWith("__Host-") ||
|
||||
(cookie.secure &&
|
||||
@@ -652,7 +684,7 @@ function jsonParse(str) {
|
||||
}
|
||||
|
||||
function fromJSON(str) {
|
||||
if (!str) {
|
||||
if (!str || validators.isEmptyString(str)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -698,6 +730,8 @@ function fromJSON(str) {
|
||||
*/
|
||||
|
||||
function cookieCompare(a, b) {
|
||||
validators.validate(validators.isObject(a), a);
|
||||
validators.validate(validators.isObject(b), b);
|
||||
let cmp = 0;
|
||||
|
||||
// descending for length: b CMP a
|
||||
@@ -725,6 +759,7 @@ function cookieCompare(a, b) {
|
||||
// Gives the permutation of all possible pathMatch()es of a given path. The
|
||||
// array is in longest-to-shortest order. Handy for indexing.
|
||||
function permutePath(path) {
|
||||
validators.validate(validators.isString(path));
|
||||
if (path === "/") {
|
||||
return ["/"];
|
||||
}
|
||||
@@ -772,13 +807,14 @@ const cookieDefaults = {
|
||||
pathIsDefault: null,
|
||||
creation: null,
|
||||
lastAccessed: null,
|
||||
sameSite: "none"
|
||||
sameSite: undefined
|
||||
};
|
||||
|
||||
class Cookie {
|
||||
constructor(options = {}) {
|
||||
if (util.inspect.custom) {
|
||||
this[util.inspect.custom] = this.inspect;
|
||||
const customInspectSymbol = getCustomInspectSymbol();
|
||||
if (customInspectSymbol) {
|
||||
this[customInspectSymbol] = this.inspect;
|
||||
}
|
||||
|
||||
Object.assign(this, cookieDefaults, options);
|
||||
@@ -1060,9 +1096,13 @@ class CookieJar {
|
||||
if (typeof options === "boolean") {
|
||||
options = { rejectPublicSuffixes: options };
|
||||
}
|
||||
validators.validate(validators.isObject(options), options);
|
||||
this.rejectPublicSuffixes = options.rejectPublicSuffixes;
|
||||
this.enableLooseMode = !!options.looseMode;
|
||||
this.allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
this.allowSpecialUseDomain =
|
||||
typeof options.allowSpecialUseDomain === "boolean"
|
||||
? options.allowSpecialUseDomain
|
||||
: true;
|
||||
this.store = store || new MemoryCookieStore();
|
||||
this.prefixSecurity = getNormalizedPrefixSecurity(options.prefixSecurity);
|
||||
this._cloneSync = syncWrap("clone");
|
||||
@@ -1076,13 +1116,31 @@ class CookieJar {
|
||||
}
|
||||
|
||||
setCookie(cookie, url, options, cb) {
|
||||
validators.validate(validators.isNonEmptyString(url), cb, options);
|
||||
let err;
|
||||
|
||||
if (validators.isFunction(url)) {
|
||||
cb = url;
|
||||
return cb(new Error("No URL was specified"));
|
||||
}
|
||||
|
||||
const context = getCookieContext(url);
|
||||
if (typeof options === "function") {
|
||||
if (validators.isFunction(options)) {
|
||||
cb = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
|
||||
if (
|
||||
!validators.isNonEmptyString(cookie) &&
|
||||
!validators.isObject(cookie) &&
|
||||
cookie instanceof String &&
|
||||
cookie.length == 0
|
||||
) {
|
||||
return cb(null);
|
||||
}
|
||||
|
||||
const host = canonicalDomain(context.hostname);
|
||||
const loose = options.loose || this.enableLooseMode;
|
||||
|
||||
@@ -1119,8 +1177,11 @@ class CookieJar {
|
||||
|
||||
// S5.3 step 5: public suffixes
|
||||
if (this.rejectPublicSuffixes && cookie.domain) {
|
||||
const suffix = pubsuffix.getPublicSuffix(cookie.cdomain());
|
||||
if (suffix == null) {
|
||||
const suffix = pubsuffix.getPublicSuffix(cookie.cdomain(), {
|
||||
allowSpecialUseDomain: this.allowSpecialUseDomain,
|
||||
ignoreError: options.ignoreError
|
||||
});
|
||||
if (suffix == null && !IP_V6_REGEX_OBJECT.test(cookie.domain)) {
|
||||
// e.g. "com"
|
||||
err = new Error("Cookie has domain set to a public suffix");
|
||||
return cb(options.ignoreError ? null : err);
|
||||
@@ -1163,7 +1224,11 @@ class CookieJar {
|
||||
}
|
||||
|
||||
// 6252bis-02 S5.4 Step 13 & 14:
|
||||
if (cookie.sameSite !== "none" && sameSiteContext) {
|
||||
if (
|
||||
cookie.sameSite !== "none" &&
|
||||
cookie.sameSite !== undefined &&
|
||||
sameSiteContext
|
||||
) {
|
||||
// "If the cookie's "same-site-flag" is not "None", and the cookie
|
||||
// is being set from a context whose "site for cookies" is not an
|
||||
// exact match for request-uri's host's registered domain, then
|
||||
@@ -1249,11 +1314,14 @@ class CookieJar {
|
||||
|
||||
// RFC6365 S5.4
|
||||
getCookies(url, options, cb) {
|
||||
validators.validate(validators.isNonEmptyString(url), cb, url);
|
||||
const context = getCookieContext(url);
|
||||
if (typeof options === "function") {
|
||||
if (validators.isFunction(options)) {
|
||||
cb = options;
|
||||
options = {};
|
||||
}
|
||||
validators.validate(validators.isObject(options), cb, options);
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
|
||||
const host = canonicalDomain(context.hostname);
|
||||
const path = context.pathname || "/";
|
||||
@@ -1369,6 +1437,7 @@ class CookieJar {
|
||||
|
||||
getCookieString(...args) {
|
||||
const cb = args.pop();
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
const next = function(err, cookies) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
@@ -1388,6 +1457,7 @@ class CookieJar {
|
||||
|
||||
getSetCookieStrings(...args) {
|
||||
const cb = args.pop();
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
const next = function(err, cookies) {
|
||||
if (err) {
|
||||
cb(err);
|
||||
@@ -1405,8 +1475,9 @@ class CookieJar {
|
||||
}
|
||||
|
||||
serialize(cb) {
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
let type = this.store.constructor.name;
|
||||
if (type === "Object") {
|
||||
if (validators.isObject(type)) {
|
||||
type = null;
|
||||
}
|
||||
|
||||
@@ -1422,6 +1493,9 @@ class CookieJar {
|
||||
|
||||
// CookieJar configuration:
|
||||
rejectPublicSuffixes: !!this.rejectPublicSuffixes,
|
||||
enableLooseMode: !!this.enableLooseMode,
|
||||
allowSpecialUseDomain: !!this.allowSpecialUseDomain,
|
||||
prefixSecurity: getNormalizedPrefixSecurity(this.prefixSecurity),
|
||||
|
||||
// this gets filled from getAllCookies:
|
||||
cookies: []
|
||||
@@ -1524,6 +1598,7 @@ class CookieJar {
|
||||
}
|
||||
|
||||
removeAllCookies(cb) {
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
const store = this.store;
|
||||
|
||||
// Check that the store implements its own removeAllCookies(). The default
|
||||
@@ -1577,6 +1652,7 @@ class CookieJar {
|
||||
cb = store;
|
||||
store = null;
|
||||
}
|
||||
validators.validate(validators.isFunction(cb), cb);
|
||||
|
||||
let serialized;
|
||||
if (typeof strOrObj === "string") {
|
||||
@@ -1588,7 +1664,12 @@ class CookieJar {
|
||||
serialized = strOrObj;
|
||||
}
|
||||
|
||||
const jar = new CookieJar(store, serialized.rejectPublicSuffixes);
|
||||
const jar = new CookieJar(store, {
|
||||
rejectPublicSuffixes: serialized.rejectPublicSuffixes,
|
||||
looseMode: serialized.enableLooseMode,
|
||||
allowSpecialUseDomain: serialized.allowSpecialUseDomain,
|
||||
prefixSecurity: serialized.prefixSecurity
|
||||
});
|
||||
jar._importCookies(serialized, err => {
|
||||
if (err) {
|
||||
return cb(err);
|
||||
@@ -1600,7 +1681,10 @@ class CookieJar {
|
||||
static deserializeSync(strOrObj, store) {
|
||||
const serialized =
|
||||
typeof strOrObj === "string" ? JSON.parse(strOrObj) : strOrObj;
|
||||
const jar = new CookieJar(store, serialized.rejectPublicSuffixes);
|
||||
const jar = new CookieJar(store, {
|
||||
rejectPublicSuffixes: serialized.rejectPublicSuffixes,
|
||||
looseMode: serialized.enableLooseMode
|
||||
});
|
||||
|
||||
// catch this mistake early:
|
||||
if (!jar.store.synchronous) {
|
||||
@@ -1669,3 +1753,4 @@ exports.permuteDomain = require("./permuteDomain").permuteDomain;
|
||||
exports.permutePath = permutePath;
|
||||
exports.canonicalDomain = canonicalDomain;
|
||||
exports.PrefixSecurityEnum = PrefixSecurityEnum;
|
||||
exports.ParameterError = validators.ParameterError;
|
||||
|
||||
62
node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js
generated
vendored
62
node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js
generated
vendored
@@ -33,19 +33,21 @@ const { fromCallback } = require("universalify");
|
||||
const Store = require("./store").Store;
|
||||
const permuteDomain = require("./permuteDomain").permuteDomain;
|
||||
const pathMatch = require("./pathMatch").pathMatch;
|
||||
const util = require("util");
|
||||
const { getCustomInspectSymbol, getUtilInspect } = require("./utilHelper");
|
||||
|
||||
class MemoryCookieStore extends Store {
|
||||
constructor() {
|
||||
super();
|
||||
this.synchronous = true;
|
||||
this.idx = {};
|
||||
if (util.inspect.custom) {
|
||||
this[util.inspect.custom] = this.inspect;
|
||||
const customInspectSymbol = getCustomInspectSymbol();
|
||||
if (customInspectSymbol) {
|
||||
this[customInspectSymbol] = this.inspect;
|
||||
}
|
||||
}
|
||||
|
||||
inspect() {
|
||||
const util = { inspect: getUtilInspect(inspectFallback) };
|
||||
return `{ idx: ${util.inspect(this.idx, false, 2)} }`;
|
||||
}
|
||||
|
||||
@@ -62,7 +64,7 @@ class MemoryCookieStore extends Store {
|
||||
const results = [];
|
||||
if (typeof allowSpecialUseDomain === "function") {
|
||||
cb = allowSpecialUseDomain;
|
||||
allowSpecialUseDomain = false;
|
||||
allowSpecialUseDomain = true;
|
||||
}
|
||||
if (!domain) {
|
||||
return cb(null, []);
|
||||
@@ -184,7 +186,57 @@ class MemoryCookieStore extends Store {
|
||||
"removeAllCookies",
|
||||
"getAllCookies"
|
||||
].forEach(name => {
|
||||
MemoryCookieStore[name] = fromCallback(MemoryCookieStore.prototype[name]);
|
||||
MemoryCookieStore.prototype[name] = fromCallback(
|
||||
MemoryCookieStore.prototype[name]
|
||||
);
|
||||
});
|
||||
|
||||
exports.MemoryCookieStore = MemoryCookieStore;
|
||||
|
||||
function inspectFallback(val) {
|
||||
const domains = Object.keys(val);
|
||||
if (domains.length === 0) {
|
||||
return "{}";
|
||||
}
|
||||
let result = "{\n";
|
||||
Object.keys(val).forEach((domain, i) => {
|
||||
result += formatDomain(domain, val[domain]);
|
||||
if (i < domains.length - 1) {
|
||||
result += ",";
|
||||
}
|
||||
result += "\n";
|
||||
});
|
||||
result += "}";
|
||||
return result;
|
||||
}
|
||||
|
||||
function formatDomain(domainName, domainValue) {
|
||||
const indent = " ";
|
||||
let result = `${indent}'${domainName}': {\n`;
|
||||
Object.keys(domainValue).forEach((path, i, paths) => {
|
||||
result += formatPath(path, domainValue[path]);
|
||||
if (i < paths.length - 1) {
|
||||
result += ",";
|
||||
}
|
||||
result += "\n";
|
||||
});
|
||||
result += `${indent}}`;
|
||||
return result;
|
||||
}
|
||||
|
||||
function formatPath(pathName, pathValue) {
|
||||
const indent = " ";
|
||||
let result = `${indent}'${pathName}': {\n`;
|
||||
Object.keys(pathValue).forEach((cookieName, i, cookieNames) => {
|
||||
const cookie = pathValue[cookieName];
|
||||
result += ` ${cookieName}: ${cookie.inspect()}`;
|
||||
if (i < cookieNames.length - 1) {
|
||||
result += ",";
|
||||
}
|
||||
result += "\n";
|
||||
});
|
||||
result += `${indent}}`;
|
||||
return result;
|
||||
}
|
||||
|
||||
exports.inspectFallback = inspectFallback;
|
||||
|
||||
23
node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js
generated
vendored
23
node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js
generated
vendored
@@ -33,21 +33,11 @@ const pubsuffix = require("./pubsuffix-psl");
|
||||
|
||||
// Gives the permutation of all possible domainMatch()es of a given domain. The
|
||||
// array is in shortest-to-longest order. Handy for indexing.
|
||||
const SPECIAL_USE_DOMAINS = ["local"]; // RFC 6761
|
||||
|
||||
function permuteDomain(domain, allowSpecialUseDomain) {
|
||||
let pubSuf = null;
|
||||
if (allowSpecialUseDomain) {
|
||||
const domainParts = domain.split(".");
|
||||
if (SPECIAL_USE_DOMAINS.includes(domainParts[domainParts.length - 1])) {
|
||||
pubSuf = `${domainParts[domainParts.length - 2]}.${
|
||||
domainParts[domainParts.length - 1]
|
||||
}`;
|
||||
} else {
|
||||
pubSuf = pubsuffix.getPublicSuffix(domain);
|
||||
}
|
||||
} else {
|
||||
pubSuf = pubsuffix.getPublicSuffix(domain);
|
||||
}
|
||||
const pubSuf = pubsuffix.getPublicSuffix(domain, {
|
||||
allowSpecialUseDomain: allowSpecialUseDomain
|
||||
});
|
||||
|
||||
if (!pubSuf) {
|
||||
return null;
|
||||
@@ -56,6 +46,11 @@ function permuteDomain(domain, allowSpecialUseDomain) {
|
||||
return [domain];
|
||||
}
|
||||
|
||||
// Nuke trailing dot
|
||||
if (domain.slice(-1) == ".") {
|
||||
domain = domain.slice(0, -1);
|
||||
}
|
||||
|
||||
const prefix = domain.slice(0, -(pubSuf.length + 1)); // ".example.com"
|
||||
const parts = prefix.split(".").reverse();
|
||||
let cur = pubSuf;
|
||||
|
||||
37
node_modules/@azure/core-http/node_modules/tough-cookie/lib/pubsuffix-psl.js
generated
vendored
37
node_modules/@azure/core-http/node_modules/tough-cookie/lib/pubsuffix-psl.js
generated
vendored
@@ -31,7 +31,42 @@
|
||||
"use strict";
|
||||
const psl = require("psl");
|
||||
|
||||
function getPublicSuffix(domain) {
|
||||
// RFC 6761
|
||||
const SPECIAL_USE_DOMAINS = [
|
||||
"local",
|
||||
"example",
|
||||
"invalid",
|
||||
"localhost",
|
||||
"test"
|
||||
];
|
||||
|
||||
const SPECIAL_TREATMENT_DOMAINS = ["localhost", "invalid"];
|
||||
|
||||
function getPublicSuffix(domain, options = {}) {
|
||||
const domainParts = domain.split(".");
|
||||
const topLevelDomain = domainParts[domainParts.length - 1];
|
||||
const allowSpecialUseDomain = !!options.allowSpecialUseDomain;
|
||||
const ignoreError = !!options.ignoreError;
|
||||
|
||||
if (allowSpecialUseDomain && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
if (domainParts.length > 1) {
|
||||
const secondLevelDomain = domainParts[domainParts.length - 2];
|
||||
// In aforementioned example, the eTLD/pubSuf will be apple.localhost
|
||||
return `${secondLevelDomain}.${topLevelDomain}`;
|
||||
} else if (SPECIAL_TREATMENT_DOMAINS.includes(topLevelDomain)) {
|
||||
// For a single word special use domain, e.g. 'localhost' or 'invalid', per RFC 6761,
|
||||
// "Application software MAY recognize {localhost/invalid} names as special, or
|
||||
// MAY pass them to name resolution APIs as they would for other domain names."
|
||||
return `${topLevelDomain}`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignoreError && SPECIAL_USE_DOMAINS.includes(topLevelDomain)) {
|
||||
throw new Error(
|
||||
`Cookie has domain set to the public suffix "${topLevelDomain}" which is a special use domain. To allow this, configure your CookieJar with {allowSpecialUseDomain:true, rejectPublicSuffixes: false}.`
|
||||
);
|
||||
}
|
||||
|
||||
return psl.get(domain);
|
||||
}
|
||||
|
||||
|
||||
39
node_modules/@azure/core-http/node_modules/tough-cookie/lib/utilHelper.js
generated
vendored
Normal file
39
node_modules/@azure/core-http/node_modules/tough-cookie/lib/utilHelper.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
function requireUtil() {
|
||||
try {
|
||||
// eslint-disable-next-line no-restricted-modules
|
||||
return require("util");
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// for v10.12.0+
|
||||
function lookupCustomInspectSymbol() {
|
||||
return Symbol.for("nodejs.util.inspect.custom");
|
||||
}
|
||||
|
||||
// for older node environments
|
||||
function tryReadingCustomSymbolFromUtilInspect(options) {
|
||||
const _requireUtil = options.requireUtil || requireUtil;
|
||||
const util = _requireUtil();
|
||||
return util ? util.inspect.custom : null;
|
||||
}
|
||||
|
||||
exports.getUtilInspect = function getUtilInspect(fallback, options = {}) {
|
||||
const _requireUtil = options.requireUtil || requireUtil;
|
||||
const util = _requireUtil();
|
||||
return function inspect(value, showHidden, depth) {
|
||||
return util ? util.inspect(value, showHidden, depth) : fallback(value);
|
||||
};
|
||||
};
|
||||
|
||||
exports.getCustomInspectSymbol = function getCustomInspectSymbol(options = {}) {
|
||||
const _lookupCustomInspectSymbol =
|
||||
options.lookupCustomInspectSymbol || lookupCustomInspectSymbol;
|
||||
|
||||
// get custom inspect symbol for node environments
|
||||
return (
|
||||
_lookupCustomInspectSymbol() ||
|
||||
tryReadingCustomSymbolFromUtilInspect(options)
|
||||
);
|
||||
};
|
||||
95
node_modules/@azure/core-http/node_modules/tough-cookie/lib/validators.js
generated
vendored
Normal file
95
node_modules/@azure/core-http/node_modules/tough-cookie/lib/validators.js
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/* ************************************************************************************
|
||||
Extracted from check-types.js
|
||||
https://gitlab.com/philbooth/check-types.js
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Phil Booth
|
||||
|
||||
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.
|
||||
|
||||
************************************************************************************ */
|
||||
"use strict";
|
||||
|
||||
/* Validation functions copied from check-types package - https://www.npmjs.com/package/check-types */
|
||||
function isFunction(data) {
|
||||
return typeof data === "function";
|
||||
}
|
||||
|
||||
function isNonEmptyString(data) {
|
||||
return isString(data) && data !== "";
|
||||
}
|
||||
|
||||
function isDate(data) {
|
||||
return isInstanceStrict(data, Date) && isInteger(data.getTime());
|
||||
}
|
||||
|
||||
function isEmptyString(data) {
|
||||
return data === "" || (data instanceof String && data.toString() === "");
|
||||
}
|
||||
|
||||
function isString(data) {
|
||||
return typeof data === "string" || data instanceof String;
|
||||
}
|
||||
|
||||
function isObject(data) {
|
||||
return toString.call(data) === "[object Object]";
|
||||
}
|
||||
function isInstanceStrict(data, prototype) {
|
||||
try {
|
||||
return data instanceof prototype;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function isInteger(data) {
|
||||
return typeof data === "number" && data % 1 === 0;
|
||||
}
|
||||
/* End validation functions */
|
||||
|
||||
function validate(bool, cb, options) {
|
||||
if (!isFunction(cb)) {
|
||||
options = cb;
|
||||
cb = null;
|
||||
}
|
||||
if (!isObject(options)) options = { Error: "Failed Check" };
|
||||
if (!bool) {
|
||||
if (cb) {
|
||||
cb(new ParameterError(options));
|
||||
} else {
|
||||
throw new ParameterError(options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ParameterError extends Error {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
}
|
||||
}
|
||||
|
||||
exports.ParameterError = ParameterError;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isNonEmptyString = isNonEmptyString;
|
||||
exports.isDate = isDate;
|
||||
exports.isEmptyString = isEmptyString;
|
||||
exports.isString = isString;
|
||||
exports.isObject = isObject;
|
||||
exports.validate = validate;
|
||||
2
node_modules/@azure/core-http/node_modules/tough-cookie/lib/version.js
generated
vendored
2
node_modules/@azure/core-http/node_modules/tough-cookie/lib/version.js
generated
vendored
@@ -1,2 +1,2 @@
|
||||
// generated by genversion
|
||||
module.exports = '4.0.0'
|
||||
module.exports = '4.1.2'
|
||||
|
||||
7
node_modules/@azure/core-http/node_modules/tough-cookie/package.json
generated
vendored
7
node_modules/@azure/core-http/node_modules/tough-cookie/package.json
generated
vendored
@@ -67,7 +67,7 @@
|
||||
"RFC6265",
|
||||
"RFC2965"
|
||||
],
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.2",
|
||||
"homepage": "https://github.com/salesforce/tough-cookie",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -82,7 +82,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"version": "genversion lib/version.js && git add lib/version.js",
|
||||
"test": "vows test/*_test.js",
|
||||
"test": "vows test/*_test.js && npm run eslint",
|
||||
"cover": "nyc --reporter=lcov --reporter=html vows test/*_test.js",
|
||||
"eslint": "eslint --env node --ext .js .",
|
||||
"prettier": "prettier '**/*.{json,ts,yaml,md}'",
|
||||
@@ -104,6 +104,7 @@
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.1.2"
|
||||
"universalify": "^0.2.0",
|
||||
"url-parse": "^1.5.3"
|
||||
}
|
||||
}
|
||||
|
||||
15
node_modules/@azure/core-http/node_modules/tslib/CopyrightNotice.txt
generated
vendored
15
node_modules/@azure/core-http/node_modules/tslib/CopyrightNotice.txt
generated
vendored
@@ -1,15 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
12
node_modules/@azure/core-http/node_modules/tslib/LICENSE.txt
generated
vendored
12
node_modules/@azure/core-http/node_modules/tslib/LICENSE.txt
generated
vendored
@@ -1,12 +0,0 @@
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
164
node_modules/@azure/core-http/node_modules/tslib/README.md
generated
vendored
164
node_modules/@azure/core-http/node_modules/tslib/README.md
generated
vendored
@@ -1,164 +0,0 @@
|
||||
# tslib
|
||||
|
||||
This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
|
||||
|
||||
This library is primarily used by the `--importHelpers` flag in TypeScript.
|
||||
When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
|
||||
|
||||
```ts
|
||||
var __assign = (this && this.__assign) || Object.assign || function(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
||||
t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
exports.x = {};
|
||||
exports.y = __assign({}, exports.x);
|
||||
|
||||
```
|
||||
|
||||
will instead be emitted as something like the following:
|
||||
|
||||
```ts
|
||||
var tslib_1 = require("tslib");
|
||||
exports.x = {};
|
||||
exports.y = tslib_1.__assign({}, exports.x);
|
||||
```
|
||||
|
||||
Because this can avoid duplicate declarations of things like `__extends`, `__assign`, etc., this means delivering users smaller files on average, as well as less runtime overhead.
|
||||
For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
|
||||
|
||||
# Installing
|
||||
|
||||
For the latest stable version, run:
|
||||
|
||||
## npm
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
npm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
npm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
npm install tslib@1.6.1
|
||||
```
|
||||
|
||||
## yarn
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
yarn add tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
yarn add tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
yarn add tslib@1.6.1
|
||||
```
|
||||
|
||||
## bower
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
bower install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
bower install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
bower install tslib@1.6.1
|
||||
```
|
||||
|
||||
## JSPM
|
||||
|
||||
```sh
|
||||
# TypeScript 3.9.2 or later
|
||||
jspm install tslib
|
||||
|
||||
# TypeScript 3.8.4 or earlier
|
||||
jspm install tslib@^1
|
||||
|
||||
# TypeScript 2.3.2 or earlier
|
||||
jspm install tslib@1.6.1
|
||||
```
|
||||
|
||||
# Usage
|
||||
|
||||
Set the `importHelpers` compiler option on the command line:
|
||||
|
||||
```
|
||||
tsc --importHelpers file.ts
|
||||
```
|
||||
|
||||
or in your tsconfig.json:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"importHelpers": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### For bower and JSPM users
|
||||
|
||||
You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "amd",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["bower_components/tslib/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
For JSPM users:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "system",
|
||||
"importHelpers": true,
|
||||
"baseUrl": "./",
|
||||
"paths": {
|
||||
"tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Deployment
|
||||
|
||||
- Choose your new version number
|
||||
- Set it in `package.json` and `bower.json`
|
||||
- Create a tag: `git tag [version]`
|
||||
- Push the tag: `git push --tags`
|
||||
- Create a [release in GitHub](https://github.com/microsoft/tslib/releases)
|
||||
- Run the [publish to npm](https://github.com/microsoft/tslib/actions?query=workflow%3A%22Publish+to+NPM%22) workflow
|
||||
|
||||
Done.
|
||||
|
||||
# Contribute
|
||||
|
||||
There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
|
||||
|
||||
* [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
|
||||
* Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
|
||||
* Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
|
||||
* Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
|
||||
* [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
# Documentation
|
||||
|
||||
* [Quick tutorial](http://www.typescriptlang.org/Tutorial)
|
||||
* [Programming handbook](http://www.typescriptlang.org/Handbook)
|
||||
* [Homepage](http://www.typescriptlang.org/)
|
||||
55
node_modules/@azure/core-http/node_modules/tslib/modules/index.js
generated
vendored
55
node_modules/@azure/core-http/node_modules/tslib/modules/index.js
generated
vendored
@@ -1,55 +0,0 @@
|
||||
import tslib from '../tslib.js';
|
||||
const {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
} = tslib;
|
||||
export {
|
||||
__extends,
|
||||
__assign,
|
||||
__rest,
|
||||
__decorate,
|
||||
__param,
|
||||
__metadata,
|
||||
__awaiter,
|
||||
__generator,
|
||||
__exportStar,
|
||||
__createBinding,
|
||||
__values,
|
||||
__read,
|
||||
__spread,
|
||||
__spreadArrays,
|
||||
__spreadArray,
|
||||
__await,
|
||||
__asyncGenerator,
|
||||
__asyncDelegator,
|
||||
__asyncValues,
|
||||
__makeTemplateObject,
|
||||
__importStar,
|
||||
__importDefault,
|
||||
__classPrivateFieldGet,
|
||||
__classPrivateFieldSet,
|
||||
__classPrivateFieldIn,
|
||||
};
|
||||
3
node_modules/@azure/core-http/node_modules/tslib/modules/package.json
generated
vendored
3
node_modules/@azure/core-http/node_modules/tslib/modules/package.json
generated
vendored
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
38
node_modules/@azure/core-http/node_modules/tslib/package.json
generated
vendored
38
node_modules/@azure/core-http/node_modules/tslib/package.json
generated
vendored
@@ -1,38 +0,0 @@
|
||||
{
|
||||
"name": "tslib",
|
||||
"author": "Microsoft Corp.",
|
||||
"homepage": "https://www.typescriptlang.org/",
|
||||
"version": "2.4.0",
|
||||
"license": "0BSD",
|
||||
"description": "Runtime library for TypeScript helper functions",
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Microsoft",
|
||||
"compiler",
|
||||
"language",
|
||||
"javascript",
|
||||
"tslib",
|
||||
"runtime"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/Microsoft/TypeScript/issues"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Microsoft/tslib.git"
|
||||
},
|
||||
"main": "tslib.js",
|
||||
"module": "tslib.es6.js",
|
||||
"jsnext:main": "tslib.es6.js",
|
||||
"typings": "tslib.d.ts",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
".": {
|
||||
"module": "./tslib.es6.js",
|
||||
"import": "./modules/index.js",
|
||||
"default": "./tslib.js"
|
||||
},
|
||||
"./*": "./*",
|
||||
"./": "./"
|
||||
}
|
||||
}
|
||||
398
node_modules/@azure/core-http/node_modules/tslib/tslib.d.ts
generated
vendored
398
node_modules/@azure/core-http/node_modules/tslib/tslib.d.ts
generated
vendored
@@ -1,398 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/**
|
||||
* Used to shim class extends.
|
||||
*
|
||||
* @param d The derived class.
|
||||
* @param b The base class.
|
||||
*/
|
||||
export declare function __extends(d: Function, b: Function): void;
|
||||
|
||||
/**
|
||||
* Copy the values of all of the enumerable own properties from one or more source objects to a
|
||||
* target object. Returns the target object.
|
||||
*
|
||||
* @param t The target object to copy to.
|
||||
* @param sources One or more source objects from which to copy properties
|
||||
*/
|
||||
export declare function __assign(t: any, ...sources: any[]): any;
|
||||
|
||||
/**
|
||||
* Performs a rest spread on an object.
|
||||
*
|
||||
* @param t The source value.
|
||||
* @param propertyNames The property names excluded from the rest spread.
|
||||
*/
|
||||
export declare function __rest(t: any, propertyNames: (string | symbol)[]): any;
|
||||
|
||||
/**
|
||||
* Applies decorators to a target object
|
||||
*
|
||||
* @param decorators The set of decorators to apply.
|
||||
* @param target The target object.
|
||||
* @param key If specified, the own property to apply the decorators to.
|
||||
* @param desc The property descriptor, defaults to fetching the descriptor from the target object.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
|
||||
|
||||
/**
|
||||
* Creates an observing function decorator from a parameter decorator.
|
||||
*
|
||||
* @param paramIndex The parameter index to apply the decorator to.
|
||||
* @param decorator The parameter decorator to apply. Note that the return value is ignored.
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __param(paramIndex: number, decorator: Function): Function;
|
||||
|
||||
/**
|
||||
* Creates a decorator that sets metadata.
|
||||
*
|
||||
* @param metadataKey The metadata key
|
||||
* @param metadataValue The metadata value
|
||||
* @experimental
|
||||
*/
|
||||
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
|
||||
|
||||
/**
|
||||
* Converts a generator function into a pseudo-async function, by treating each `yield` as an `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param P The optional promise constructor argument, defaults to the `Promise` property of the global object.
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __awaiter(thisArg: any, _arguments: any, P: Function, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Creates an Iterator object using the body as the implementation.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the function
|
||||
* @param body The generator state-machine based implementation.
|
||||
*
|
||||
* @see [./docs/generator.md]
|
||||
*/
|
||||
export declare function __generator(thisArg: any, body: Function): any;
|
||||
|
||||
/**
|
||||
* Creates bindings for all enumerable properties of `m` on `exports`
|
||||
*
|
||||
* @param m The source object
|
||||
* @param exports The `exports` object.
|
||||
*/
|
||||
export declare function __exportStar(m: any, o: any): void;
|
||||
|
||||
/**
|
||||
* Creates a value iterator from an `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __values(o: any): any;
|
||||
|
||||
/**
|
||||
* Reads values from an `Iterable` or `ArrayLike` object and returns the resulting array.
|
||||
*
|
||||
* @param o The object to read from.
|
||||
* @param n The maximum number of arguments to read, defaults to `Infinity`.
|
||||
*/
|
||||
export declare function __read(o: any, n?: number): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from iterable spread.
|
||||
*
|
||||
* @param args The Iterable objects to spread.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spread(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Creates an array from array spread.
|
||||
*
|
||||
* @param args The ArrayLikes to spread into the resulting array.
|
||||
* @deprecated since TypeScript 4.2 - Use `__spreadArray`
|
||||
*/
|
||||
export declare function __spreadArrays(...args: any[][]): any[];
|
||||
|
||||
/**
|
||||
* Spreads the `from` array into the `to` array.
|
||||
*
|
||||
* @param pack Replace empty elements with `undefined`.
|
||||
*/
|
||||
export declare function __spreadArray(to: any[], from: any[], pack?: boolean): any[];
|
||||
|
||||
/**
|
||||
* Creates an object that signals to `__asyncGenerator` that it shouldn't be yielded,
|
||||
* and instead should be awaited and the resulting value passed back to the generator.
|
||||
*
|
||||
* @param v The value to await.
|
||||
*/
|
||||
export declare function __await(v: any): any;
|
||||
|
||||
/**
|
||||
* Converts a generator function into an async generator function, by using `yield __await`
|
||||
* in place of normal `await`.
|
||||
*
|
||||
* @param thisArg The reference to use as the `this` value in the generator function
|
||||
* @param _arguments The optional arguments array
|
||||
* @param generator The generator function
|
||||
*/
|
||||
export declare function __asyncGenerator(thisArg: any, _arguments: any, generator: Function): any;
|
||||
|
||||
/**
|
||||
* Used to wrap a potentially async iterator in such a way so that it wraps the result
|
||||
* of calling iterator methods of `o` in `__await` instances, and then yields the awaited values.
|
||||
*
|
||||
* @param o The potentially async iterator.
|
||||
* @returns A synchronous iterator yielding `__await` instances on every odd invocation
|
||||
* and returning the awaited `IteratorResult` passed to `next` every even invocation.
|
||||
*/
|
||||
export declare function __asyncDelegator(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a value async iterator from an `AsyncIterable`, `Iterable` or `ArrayLike` object.
|
||||
*
|
||||
* @param o The object.
|
||||
* @throws {TypeError} If `o` is neither `AsyncIterable`, `Iterable`, nor an `ArrayLike`.
|
||||
*/
|
||||
export declare function __asyncValues(o: any): any;
|
||||
|
||||
/**
|
||||
* Creates a `TemplateStringsArray` frozen object from the `cooked` and `raw` arrays.
|
||||
*
|
||||
* @param cooked The cooked possibly-sparse array.
|
||||
* @param raw The raw string content.
|
||||
*/
|
||||
export declare function __makeTemplateObject(cooked: string[], raw: string[]): TemplateStringsArray;
|
||||
|
||||
/**
|
||||
* Used to shim default and named imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default, { Named, Other } from "mod";
|
||||
* // or
|
||||
* import { default as Default, Named, Other } from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importStar<T>(mod: T): T;
|
||||
|
||||
/**
|
||||
* Used to shim default imports in ECMAScript Modules transpiled to CommonJS.
|
||||
*
|
||||
* ```js
|
||||
* import Default from "mod";
|
||||
* ```
|
||||
*
|
||||
* @param mod The CommonJS module exports object.
|
||||
*/
|
||||
export declare function __importDefault<T>(mod: T): T | { default: T };
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance field.
|
||||
*
|
||||
* @param receiver The instance from which to read the private field.
|
||||
* @param state A WeakMap containing the private field value for an instance.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, get(o: T): V | undefined },
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static field.
|
||||
*
|
||||
* @param receiver The object from which to read the private static field.
|
||||
* @param state The class constructor containing the definition of the static field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private instance "get" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private "get" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates evaluating a private static "get" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "get" accessor.
|
||||
* @param state The class constructor containing the definition of the static "get" accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "get" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "a",
|
||||
f: () => V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private instance method.
|
||||
*
|
||||
* @param receiver The instance from which to read a private method.
|
||||
* @param state A WeakSet used to verify an instance supports the private method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private instance method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends object, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates reading a private static method.
|
||||
*
|
||||
* @param receiver The object from which to read the private static method.
|
||||
* @param state The class constructor containing the definition of the static method.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The function to return as the private static method.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldGet<T extends new (...args: any[]) => unknown, V extends (...args: any[]) => unknown>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
kind: "m",
|
||||
f: V
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance field.
|
||||
*
|
||||
* @param receiver The instance on which to set a private field value.
|
||||
* @param state A WeakMap used to store the private field value for an instance.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean, set(o: T, value: V): unknown },
|
||||
value: V,
|
||||
kind?: "f"
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static field.
|
||||
*
|
||||
* @param receiver The object on which to set the private static field.
|
||||
* @param state The class constructor containing the definition of the private static field.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The descriptor that holds the static field value.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "f",
|
||||
f: { value: V }
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private instance "set" accessor.
|
||||
*
|
||||
* @param receiver The instance on which to evaluate the private instance "set" accessor.
|
||||
* @param state A WeakSet used to verify an instance supports the private "set" accessor.
|
||||
* @param value The value to store in the private accessor.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `state` doesn't have an entry for `receiver`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends object, V>(
|
||||
receiver: T,
|
||||
state: { has(o: T): boolean },
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Emulates writing to a private static "set" accessor.
|
||||
*
|
||||
* @param receiver The object on which to evaluate the private static "set" accessor.
|
||||
* @param state The class constructor containing the definition of the static "set" accessor.
|
||||
* @param value The value to store in the private field.
|
||||
* @param kind Either `"f"` for a field, `"a"` for an accessor, or `"m"` for a method.
|
||||
* @param f The "set" accessor function to evaluate.
|
||||
*
|
||||
* @throws {TypeError} If `receiver` is not `state`.
|
||||
*/
|
||||
export declare function __classPrivateFieldSet<T extends new (...args: any[]) => unknown, V>(
|
||||
receiver: T,
|
||||
state: T,
|
||||
value: V,
|
||||
kind: "a",
|
||||
f: (v: V) => void
|
||||
): V;
|
||||
|
||||
/**
|
||||
* Checks for the existence of a private field/method/accessor.
|
||||
*
|
||||
* @param state The class constructor containing the static member, or the WeakMap or WeakSet associated with a private instance member.
|
||||
* @param receiver The object for which to test the presence of the private member.
|
||||
*/
|
||||
export declare function __classPrivateFieldIn(
|
||||
state: (new (...args: any[]) => unknown) | { has(o: any): boolean },
|
||||
receiver: unknown,
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* Creates a re-export binding on `object` with key `objectKey` that references `target[key]`.
|
||||
*
|
||||
* @param object The local `exports` object.
|
||||
* @param target The object to re-export from.
|
||||
* @param key The property key of `target` to re-export.
|
||||
* @param objectKey The property key to re-export as. Defaults to `key`.
|
||||
*/
|
||||
export declare function __createBinding(object: object, target: object, key: PropertyKey, objectKey?: PropertyKey): void;
|
||||
1
node_modules/@azure/core-http/node_modules/tslib/tslib.es6.html
generated
vendored
1
node_modules/@azure/core-http/node_modules/tslib/tslib.es6.html
generated
vendored
@@ -1 +0,0 @@
|
||||
<script src="tslib.es6.js"></script>
|
||||
248
node_modules/@azure/core-http/node_modules/tslib/tslib.es6.js
generated
vendored
248
node_modules/@azure/core-http/node_modules/tslib/tslib.es6.js
generated
vendored
@@ -1,248 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = function(d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
|
||||
export function __extends(d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
export var __assign = function() {
|
||||
__assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
return __assign.apply(this, arguments);
|
||||
}
|
||||
|
||||
export function __rest(s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
export function __decorate(decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
}
|
||||
|
||||
export function __param(paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
}
|
||||
|
||||
export function __metadata(metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
}
|
||||
|
||||
export function __awaiter(thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
}
|
||||
|
||||
export function __generator(thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
}
|
||||
|
||||
export var __createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
export function __exportStar(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
}
|
||||
|
||||
export function __values(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
}
|
||||
|
||||
export function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spread() {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export function __spreadArrays() {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
}
|
||||
|
||||
export function __spreadArray(to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
}
|
||||
|
||||
export function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
export function __asyncGenerator(thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
}
|
||||
|
||||
export function __asyncDelegator(o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
}
|
||||
|
||||
export function __asyncValues(o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
}
|
||||
|
||||
export function __makeTemplateObject(cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
export function __importStar(mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
}
|
||||
|
||||
export function __importDefault(mod) {
|
||||
return (mod && mod.__esModule) ? mod : { default: mod };
|
||||
}
|
||||
|
||||
export function __classPrivateFieldGet(receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
}
|
||||
|
||||
export function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
}
|
||||
|
||||
export function __classPrivateFieldIn(state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
}
|
||||
1
node_modules/@azure/core-http/node_modules/tslib/tslib.html
generated
vendored
1
node_modules/@azure/core-http/node_modules/tslib/tslib.html
generated
vendored
@@ -1 +0,0 @@
|
||||
<script src="tslib.js"></script>
|
||||
317
node_modules/@azure/core-http/node_modules/tslib/tslib.js
generated
vendored
317
node_modules/@azure/core-http/node_modules/tslib/tslib.js
generated
vendored
@@ -1,317 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** */
|
||||
/* global global, define, System, Reflect, Promise */
|
||||
var __extends;
|
||||
var __assign;
|
||||
var __rest;
|
||||
var __decorate;
|
||||
var __param;
|
||||
var __metadata;
|
||||
var __awaiter;
|
||||
var __generator;
|
||||
var __exportStar;
|
||||
var __values;
|
||||
var __read;
|
||||
var __spread;
|
||||
var __spreadArrays;
|
||||
var __spreadArray;
|
||||
var __await;
|
||||
var __asyncGenerator;
|
||||
var __asyncDelegator;
|
||||
var __asyncValues;
|
||||
var __makeTemplateObject;
|
||||
var __importStar;
|
||||
var __importDefault;
|
||||
var __classPrivateFieldGet;
|
||||
var __classPrivateFieldSet;
|
||||
var __classPrivateFieldIn;
|
||||
var __createBinding;
|
||||
(function (factory) {
|
||||
var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {};
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); });
|
||||
}
|
||||
else if (typeof module === "object" && typeof module.exports === "object") {
|
||||
factory(createExporter(root, createExporter(module.exports)));
|
||||
}
|
||||
else {
|
||||
factory(createExporter(root));
|
||||
}
|
||||
function createExporter(exports, previous) {
|
||||
if (exports !== root) {
|
||||
if (typeof Object.create === "function") {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
}
|
||||
else {
|
||||
exports.__esModule = true;
|
||||
}
|
||||
}
|
||||
return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };
|
||||
}
|
||||
})
|
||||
(function (exporter) {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
|
||||
__extends = function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
|
||||
__assign = Object.assign || function (t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__rest = function (s, e) {
|
||||
var t = {};
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
||||
t[p] = s[p];
|
||||
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
||||
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
||||
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
||||
t[p[i]] = s[p[i]];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
__decorate = function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
||||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
||||
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
||||
};
|
||||
|
||||
__param = function (paramIndex, decorator) {
|
||||
return function (target, key) { decorator(target, key, paramIndex); }
|
||||
};
|
||||
|
||||
__metadata = function (metadataKey, metadataValue) {
|
||||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
||||
};
|
||||
|
||||
__awaiter = function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
|
||||
__generator = function (thisArg, body) {
|
||||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
||||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
||||
function verb(n) { return function (v) { return step([n, v]); }; }
|
||||
function step(op) {
|
||||
if (f) throw new TypeError("Generator is already executing.");
|
||||
while (_) try {
|
||||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
||||
if (y = 0, t) op = [op[0] & 2, t.value];
|
||||
switch (op[0]) {
|
||||
case 0: case 1: t = op; break;
|
||||
case 4: _.label++; return { value: op[1], done: false };
|
||||
case 5: _.label++; y = op[1]; op = [0]; continue;
|
||||
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
||||
default:
|
||||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
||||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
||||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
||||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
||||
if (t[2]) _.ops.pop();
|
||||
_.trys.pop(); continue;
|
||||
}
|
||||
op = body.call(thisArg, _);
|
||||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||
}
|
||||
};
|
||||
|
||||
__exportStar = function(m, o) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
||||
};
|
||||
|
||||
__createBinding = Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
});
|
||||
|
||||
__values = function (o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
|
||||
__read = function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spread = function () {
|
||||
for (var ar = [], i = 0; i < arguments.length; i++)
|
||||
ar = ar.concat(__read(arguments[i]));
|
||||
return ar;
|
||||
};
|
||||
|
||||
/** @deprecated */
|
||||
__spreadArrays = function () {
|
||||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
||||
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
||||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
||||
r[k] = a[j];
|
||||
return r;
|
||||
};
|
||||
|
||||
__spreadArray = function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
|
||||
__await = function (v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
};
|
||||
|
||||
__asyncGenerator = function (thisArg, _arguments, generator) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
||||
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
||||
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
||||
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
||||
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
||||
function fulfill(value) { resume("next", value); }
|
||||
function reject(value) { resume("throw", value); }
|
||||
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
||||
};
|
||||
|
||||
__asyncDelegator = function (o) {
|
||||
var i, p;
|
||||
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
||||
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
||||
};
|
||||
|
||||
__asyncValues = function (o) {
|
||||
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
||||
var m = o[Symbol.asyncIterator], i;
|
||||
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
||||
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
||||
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
||||
};
|
||||
|
||||
__makeTemplateObject = function (cooked, raw) {
|
||||
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
||||
return cooked;
|
||||
};
|
||||
|
||||
var __setModuleDefault = Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
};
|
||||
|
||||
__importStar = function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
|
||||
__importDefault = function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
|
||||
__classPrivateFieldGet = function (receiver, state, kind, f) {
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
||||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
||||
};
|
||||
|
||||
__classPrivateFieldSet = function (receiver, state, value, kind, f) {
|
||||
if (kind === "m") throw new TypeError("Private method is not writable");
|
||||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
||||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
||||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
||||
};
|
||||
|
||||
__classPrivateFieldIn = function (state, receiver) {
|
||||
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
|
||||
return typeof state === "function" ? receiver === state : state.has(receiver);
|
||||
};
|
||||
|
||||
exporter("__extends", __extends);
|
||||
exporter("__assign", __assign);
|
||||
exporter("__rest", __rest);
|
||||
exporter("__decorate", __decorate);
|
||||
exporter("__param", __param);
|
||||
exporter("__metadata", __metadata);
|
||||
exporter("__awaiter", __awaiter);
|
||||
exporter("__generator", __generator);
|
||||
exporter("__exportStar", __exportStar);
|
||||
exporter("__createBinding", __createBinding);
|
||||
exporter("__values", __values);
|
||||
exporter("__read", __read);
|
||||
exporter("__spread", __spread);
|
||||
exporter("__spreadArrays", __spreadArrays);
|
||||
exporter("__spreadArray", __spreadArray);
|
||||
exporter("__await", __await);
|
||||
exporter("__asyncGenerator", __asyncGenerator);
|
||||
exporter("__asyncDelegator", __asyncDelegator);
|
||||
exporter("__asyncValues", __asyncValues);
|
||||
exporter("__makeTemplateObject", __makeTemplateObject);
|
||||
exporter("__importStar", __importStar);
|
||||
exporter("__importDefault", __importDefault);
|
||||
exporter("__classPrivateFieldGet", __classPrivateFieldGet);
|
||||
exporter("__classPrivateFieldSet", __classPrivateFieldSet);
|
||||
exporter("__classPrivateFieldIn", __classPrivateFieldIn);
|
||||
});
|
||||
Reference in New Issue
Block a user